Collapsible
uistableCollapsible — extracted 1:1 from WEM-App.
npx shadcn add @krawma/collapsiblenpm: radix-ui@^1.6.1
Preview
States
openclosed
Keyboard
EnterSpace
Purpose
A single show/hide region toggled by a trigger — the low-level primitive behind
disclosure UI. For multiple coordinated sections use accordion; for overlay
content use popover/dropdown-menu.
Anatomy
Collapsible › CollapsibleTrigger + CollapsibleContent. Unstyled by design —
you bring the trigger's and content's appearance.
Style
No variants and minimal styling — it's a behavior primitive. Compose your own chevron/animation; content is unmounted when closed.
Behavior & functionality
Controlled (open + onOpenChange) or uncontrolled (defaultOpen).
Accessibility
- Trigger toggles with Enter/Space and exposes
aria-expanded+aria-controlswired to the content. Give the trigger a clear label.
Do / Don't
- ✅ Use for a one-off "show more/less" toggle.
- ❌ Don't reimplement
accordionfrom many collapsibles — useaccordionfor coordinated single/multiple-open behavior.