shadcn.io is not affiliated with official shadcn/ui
Collapsible examples · Faq
FAQ with Badge Collapsible for React
An FAQ question with a Popular badge and a leading chevron that points down when the answer opens.
An FAQ question that flags the most-asked ones. A chevron leads the row and turns to point down when the answer opens, and an outline Popular Badge sits after the question. The answer is indented to line up with the question text.
Preview
Installation
FAQ
Where do the chevron, the question, and Popular sit?
All in the trigger, a flex items-start gap-3 row: the chevron first, then a wrapping group with the question and the badge. The h3 around the trigger makes the question a heading.
Why does the answer use ms-7?
It's the chevron's size-4 plus the gap-3 after it, so the answer starts under the question instead of under the chevron. ms is a logical margin, so it follows right-to-left pages.
Does ChevronRight turn when the answer opens?
Yes, a quarter turn to point down. The trigger has the group class and sets aria-expanded while open, so group-aria-expanded:rotate-90 on ChevronRightIcon turns it, eased by transition-transform duration-200.
Is Popular part of the button name?
Yes. The badge is inside the trigger, so the name is the question followed by Popular. The chevron is aria-hidden.
Related
- FAQ Item CollapsibleAn FAQ question with a plus that turns
- Numbered FAQ CollapsibleAn FAQ question led by a round number
- Card with Badge CollapsibleA card whose Premium Features header
- FAQ with Icon CollapsibleAn FAQ question in a bordered box, led by
- Badge with Text (Standard)A default badge with a short label for a
- FAQ Card Style CollapsibleAn FAQ question in a card with a hover