Collapsible
A lightweight disclosure for revealing supporting content without an accordion-style container.
Collapsible reveals supporting content without forcing a full accordion layout. It is built on Radix UI, so the trigger exposes the expected disclosure semantics and keeps keyboard interaction intact while matching the rest of the glass component set.
Use it when you need one independent disclosure with a compact, button-like trigger and content that appears directly underneath. If you need stacked, coordinated sections, use Accordion instead.
Installation
npx @glass-ui-kit/cli add collapsibleUsage
Examples
Sizes
Use the size prop to match the trigger to surrounding button density.
Variants
Use the variant prop to tune trigger emphasis without changing the lightweight layout.
Disabled
Use disabled when the disclosure should stay visible but not interactive.
Active disclosures reveal supporting rows directly under the trigger.
Controlled
Use open and onOpenChange when another part of the interface needs to coordinate the disclosure state.
asChild
Use asChild when another interactive element should become the trigger. In that mode, Radix forwards disclosure state and ARIA props to your child, and you are responsible for rendering the label, layout, and any chevron/icon yourself.
Styling
Collapsible follows a prop-first API, but unlike Accordion it does not ship as a framed item container. Reach for variant to adjust trigger depth, then use className for local layout changes such as width constraints or extra spacing around the revealed content.
API Reference
Collapsible
Accepts all Radix Collapsible.Root props.
| Prop | Type |
|---|---|
defaultOpen | boolean |
open | boolean |
onOpenChange | (open: boolean) => void |
disabled | boolean |
variant | "default" | "soft" | "strong" |
className | string |
variant changes the trigger surface emphasis only. Content remains layout-light so you can compose your own rows, lists, or small token groups underneath.
CollapsibleTrigger
| Prop | Type |
|---|---|
disabled | boolean |
asChild | boolean |
size | "sm" | "md" | "lg" |
className | string |
size mirrors the density of Button. In the default trigger mode, CollapsibleTrigger renders the built-in chevron and wraps its children in the compact disclosure layout. When asChild is set, Radix applies trigger props and classes to your child, and your child owns the visible content, spacing, and chevron/icon.
CollapsibleContent
| Prop | Type |
|---|---|
forceMount | boolean |
className | string |