shadcn.io is not affiliated with official shadcn/ui
Collapsible examples · Card
Card with Badge Collapsible for React
A card whose Premium Features header carries a New badge and expands to a short description.
A card header that flags what's new. Premium Features sits beside a secondary New Badge, with a chevron at the end that turns over when the card opens to a short description. Use it to point out a new or changed section without opening it for everyone.
Preview
Installation
FAQ
Where does the New badge sit?
Inside the trigger, in a flex items-center gap-2 group with the Premium Features title. The trigger's justify-between pushes the chevron to the end of the row.
Does New get announced with the heading?
Yes. The badge is inside the trigger, so the button's name is Premium Features New. Move the badge out of the trigger if it shouldn't be part of the name.
How do I change the New badge?
Change its text or variant: this one is secondary. Keep it short so the header stays on one line.
Can I put another badge on this header?
Yes. Add it to the same group as the title, and the gap-2 spaces it. Every badge inside the trigger becomes part of its name.
Related
- Card CollapsibleA card with a Features header that
- Card with Icon Header CollapsibleA card whose header has an icon tile, a
- FAQ with Badge CollapsibleAn FAQ question with a Popular badge and
- Badge with Text (Standard)A default badge with a short label for a
- With Subtitle CheckboxA checkbox whose label has a short muted
- Nested Card Content CollapsibleA Product Details card that expands to