Skip to content

Compact bordered FAQ in React

A tight accordion within a single frame, for practical information pages.

Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in React

CompactBorderedFaq.tsx
export function CompactBorderedFaq() {
  return (
    <div className="mx-auto w-[min(100%_-_2rem,40rem)] py-8">
      <section>
        <h2 className="mb-4 text-2xl font-bold">Informations pratiques</h2>
        <div className="overflow-hidden rounded-xl border border-[#c9e6e3] bg-white dark:border-[#1d3f3b] dark:bg-[#0b1f1d]">
          <details className="group border-[#c9e6e3] not-first:border-t open:bg-[#f0fbfa] dark:border-[#1d3f3b] dark:open:bg-[#11302d]">
            <summary className="flex cursor-pointer list-none justify-between gap-4 px-4 py-3.5 text-[0.95rem] font-semibold after:shrink-0 after:text-xs after:font-medium after:text-[#3f5f5b] after:content-['Afficher'] group-open:after:content-['Masquer'] focus-visible:outline-3 focus-visible:-outline-offset-3 focus-visible:outline-teal-700 dark:after:text-[#a7cfc9] dark:focus-visible:outline-teal-300 [&::-webkit-details-marker]:hidden">
              Le cabinet est-il accessible en fauteuil roulant ?
            </summary>
            <p className="px-4 pb-3.5 text-[0.95rem] leading-normal text-[#3f5f5b] dark:text-[#a7cfc9]">
              Oui, le cabinet est de plain-pied avec une place de stationnement réservée devant

Free component: copy it freely, including for commercial projects.

FAQ and accordions components in React
  • A native accordion FAQ where each answer asks “Was this answer helpful?”, with a thank-you message and a remembered vote.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An introduction and a contact link on the left, expandable questions on the right.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Questions grouped under subheadings, for long FAQs.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • All answers visible at once, presented as a card grid.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Frequently asked questions followed by a card inviting visitors to call or write.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Questions that expand one by one, with FAQPage structured data for Google.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component