shadcn.io is not affiliated with official shadcn/ui
Collapsible examples · Card
Card with Icon Header Collapsible for React
A card whose header has an icon tile, a title and a hint line, and expands to more details.
A card header with more to say than a title. An icon tile, the title Additional Information and a muted Click to expand line make up the trigger, and the plus in the tile turns into a cross while the card is open. Use it for optional details, help sections and settings groups.
Preview
Installation
FAQ
How is the header laid out?
The trigger is flex items-center gap-3 p-4. First comes a size-8 tile with rounded-md bg-primary/10 holding the plus, then a flex-1 column with the title and the hint line.
What does the trigger announce?
Its text: Additional Information Click to expand. The plus is aria-hidden, so it adds nothing.
Why does the icon box sit in the middle of the two lines?
items-center on the trigger centers the tile against the two-line text block. Use items-start to line it up with the title instead.
How do I swap the plus icon?
Replace PlusIcon with another Lucide icon and keep size-4 text-primary. Drop group-aria-expanded:rotate-45 if the new icon shouldn't turn when the card opens.
Related
- Card CollapsibleA card with a Features header that
- Card with Badge CollapsibleA card whose Premium Features header
- FAQ with Icon CollapsibleAn FAQ question in a bordered box, led by
- Nested Card Content CollapsibleA Product Details card that expands to
- With Description CheckboxA checkbox with a label and a line of
- Simple CollapsibleA ghost Toggle button with a chevron that