shadcn.io is not affiliated with official shadcn/ui
Collapsible examples · Standard
Collapsible with Icon for React
A Show more information trigger with a plus icon that reveals two more paragraphs.
A text link that reveals more. Show more information leads with a plus that turns into a cross when two extra paragraphs open below it, and the label underlines on hover. Use it for optional details inside an article or a form.
Preview
Installation
FAQ
How is Show more information built?
CollapsibleTrigger with flex items-center gap-2 font-medium text-sm, holding PlusIcon and the label. self-start keeps the trigger as wide as its text.
What spaces the trigger and the paragraphs?
Collapsible is a flex flex-col gap-2 column, which separates the trigger from the content. CollapsibleContent is a column with gap-2 too, which separates the two paragraphs.
Does Plus change when the text opens?
Yes, it turns 45 degrees into a cross. The trigger has the group class and sets aria-expanded while open, so group-aria-expanded:rotate-45 on PlusIcon turns it, eased by transition-transform duration-200.
Related
- Simple CollapsibleA ghost Toggle button with a chevron that
- Inline Trigger CollapsibleA question with an up-down chevron at the
- Text-only CollapsibleA Settings heading with a bracketed
- FAQ Item CollapsibleAn FAQ question with a plus that turns
- Button with Text (Link)Underline on hover, no fill
- Card CollapsibleA card with a Features header that