Collapsible
Hide secondary content. Reduce visual noise. Improve focus.
Build settings
Framework preset detected: Vite. These values are used on every deployment.
Installation
pnpm dlx nachui add collapsibleAnatomy
Composition
Use the following composition to build a
Collapsible:Variants
Bordered
Collapsible with border and rounded corners.
- Edge cache hits
- 286 GB
- Origin responses
- 104 GB
- Image optimization
- 22 GB
Card
Collapsible with card styling including border, background, and shadow.
- 09:12Investigating slow responses on /v1/orders.
- 09:41Traced to a saturated read replica, traffic shifted to iad1.
- 10:05Latency back to normal, replica replaced.
API Reference
Collapsible
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean | false | Initial open state (uncontrolled mode). |
open | boolean | — | Controlled open state. |
onOpenChange | (open: boolean) => void | — | Callback fired when the open state changes. |
disabled | boolean | false | Disables interaction. |
variant | 'default' | 'bordered' | 'card' | 'default' | Visual style of the collapsible container. |
className | string | — | Additional classes. |
children | React.ReactNode | — | Content inside the collapsible. |
Collapsible.Trigger
| Prop | Type | Default | Description |
|---|---|---|---|
showChevron | boolean | true | Shows the chevron icon. |
chevronIcon | React.ReactNode | — | Custom icon for the chevron. |
chevronPosition | 'left' | 'right' | 'right' | Position of the chevron icon. |
asChild | boolean | false | Allows passing a custom child element as the trigger. |
children | React.ReactNode | — | Trigger label or content. |
onClick | (event: React.MouseEvent) => void | — | Click handler (merged with open/close logic). |
className | string | — | Additional classes. |
Collapsible.Content
| Prop | Type | Default | Description |
|---|---|---|---|
forceMount | boolean | false | Renders content even when closed (useful for SSR). |
children | React.ReactNode | — | Content to be revealed/collapsed. |
className | string | — | Additional classes. |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.