Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
Collapsible ├── CollapsibleTrigger │ └── CollapsibleIndicator (optional) └── CollapsibleContent
Examples
Default
Loading...
Flight Details
Loading...
Order Summary
Loading...
Settings Panel
Loading...
API Reference
Collapsible
| Prop | Type | Default | Description |
|---|---|---|---|
id | string | undefined | — | Unique identifier used to connect the component parts. |
ids | ElementIds | undefined | — | Overrides generated identifiers for individual parts. |
open | boolean | undefined | — | Whether the component is open when controlled. |
defaultOpen | boolean | undefined | — | Initial open state when uncontrolled. |
onOpenChange | ((details: OpenChangeDetails) => void) | undefined | — | Runs when open changes. |
onExitComplete | VoidFunction | undefined | — | Runs when exit complete changes. |
disabled | boolean | undefined | false | Disables interaction with the component. |
collapsedHeight | number | string | undefined | — | Configures collapsed height. |
collapsedWidth | number | string | undefined | — | Configures collapsed width. |
Context, Hooks, and Types
| Export | API |
|---|---|
CollapsibleContext | Render-prop component that exposes component state and actions. |
CollapsibleRootProvider | Provides an externally created API to the component tree. |
useCollapsible | Creates or accesses the component API. |
useCollapsibleContext | Returns the nearest component API. |
CollapsibleOpenChangeDetails | Type for the details object passed to the matching change callback. |
Angular
React
Solid
Svelte
Vue