shadcn.io is not affiliated with official shadcn/ui
Collapsible examples · Faq
FAQ Card Style Collapsible for React
An FAQ question in a card with a hover tint and a chevron that turns when the answer opens.
One FAQ question in its own card. The trigger, wrapped in a heading, tints on hover and has a chevron that turns over when the answer opens under a divider. Use it on pricing and help pages where each question stands on its own.
Preview
Installation
FAQ
Which classes make the card?
Collapsible has rounded-lg border bg-card shadow-sm and overflow-hidden, so the hover tint stays inside the rounded corners. CollapsibleContent adds border-t px-4 py-3 above the answer.
What does hover:bg-muted/50 change?
It tints the trigger row with half of the muted color while the pointer is over it, a cue that the whole row is clickable.
Why does the trigger set text-start?
Buttons center their text by default. text-start lines a long question up with the start edge, and follows the page in right-to-left layouts.
Does the chevron rotate when the answer opens?
Yes. The trigger has the group class and sets aria-expanded while open, so group-aria-expanded:rotate-180 on ChevronDownIcon turns it, eased by transition-transform duration-200.
How do I show more questions in this style?
Repeat the card in a flex flex-col gap-2 list. Each Collapsible opens on its own. When several sit in one list and only one should be open at a time, with arrow keys between the headers, use an Accordion.
Related
- FAQ Item CollapsibleAn FAQ question with a plus that turns
- FAQ with Icon CollapsibleAn FAQ question in a bordered box, led by
- Card CollapsibleA card with a Features header that
- Numbered FAQ CollapsibleAn FAQ question led by a round number
- Standard Accordion with ChevronA bordered accordion of three questions
- FAQ with Badge CollapsibleAn FAQ question with a Popular badge and