Collapsible
Show and hide a single region with animated height.
Install
npx shadcn@latest add https://plinth.dhrumilkherde.com/r/collapsible.jsonUsage
import {
Collapsible, CollapsibleTrigger, CollapsiblePanel,
} from "@/components/ui/collapsible";
<Collapsible defaultOpen>
<CollapsibleTrigger render={<Button variant="ghost">Advanced options</Button>} />
<CollapsiblePanel>{/* content */}</CollapsiblePanel>
</Collapsible>Props
Root: open / defaultOpen, onOpenChange, disabled.
Accessibility
- The trigger gets
aria-expandedandaria-controlsautomatically. - For multiple related sections, use an Accordion instead.