Components
Collapsible
Show and hide one section of content with a trigger.
Loading...
Installation
npx shadcn@latest add @fujin/collapsibleUsage
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from "@/components/ui/collapsible"<Collapsible>
<CollapsibleTrigger
render={<Button variant="ghost">Advanced options</Button>}
/>
<CollapsibleContent>...</CollapsibleContent>
</Collapsible>The trigger is unstyled - render a Button (or any control) through render.
It gets aria-expanded and aria-controls from Base UI, so an icon-only
trigger only needs an aria-label that names the section, not its state.
What's different from shadcn/ui
CollapsibleContentanimates its height with Base UI's--collapsible-panel-heightvariable (shadcn's collapsible is unstyled). The animation is skipped underprefers-reduced-motion.renderreplacesasChild.
API Reference
Prop
Type
Every other prop is forwarded to the Base UI Collapsible.