- components
- ›
- collapsible
- ›
- react
Collapsible
A container that can be expanded or collapsed to show or hide content.
Warning
This feature is currently in a beta status and not intended for production use. It may receive breaking
changes before its stable release.
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et?
Controlled
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et?
Indicator
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Numquam assumenda veritatis modi repellendus enim accusantium inventore architecto maxime voluptates quibusdam velit perferendis mollitia, quas, aliquam sapiente adipisci illo nostrum vitae?
Disabled
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quas maxime in praesentium reiciendis eveniet modi mollitia? Odio accusantium veritatis accusamus quia placeat sapiente reiciendis? Consectetur, quis! Voluptatem omnis accusantium blanditiis.
Alignment
Lorem ipsum dolor sit amet consectetur, adipisicing elit. Velit pariatur error soluta voluptate, accusantium modi repudiandae omnis eligendi, suscipit repellat impedit architecto neque sequi mollitia autem dicta quae ipsum et?
API Reference
Root
| Property | Default | Type |
|---|---|---|
ids | - | Partial<{ root: string; content: string; trigger: string; }> | undefined The ids of the elements in the collapsible. Useful for composition. |
open | - | boolean | undefinedThe controlled open state of the collapsible. |
defaultOpen | - | boolean | undefinedThe initial open state of the collapsible when rendered. Use when you don't need to control the open state of the collapsible. |
onOpenChange | - | ((details: OpenChangeDetails) => void) | undefinedThe callback invoked when the open state changes. |
onExitComplete | - | VoidFunction | undefinedThe callback invoked when the exit animation completes. |
disabled | - | boolean | undefinedWhether the collapsible is disabled. |
collapsedHeight | - | string | number | undefinedThe height of the content when collapsed. |
collapsedWidth | - | string | number | undefinedThe width of the content when collapsed. |
getRootNode | - | (() => ShadowRoot | Node | Document) | undefinedA root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
dir | "ltr" | "ltr" | "rtl" | undefinedThe document's text/writing direction. |
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
RootProvider
| Property | Default | Type |
|---|---|---|
value | - | CollapsibleApi<PropTypes> |
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
RootContext
| Property | Default | Type |
|---|---|---|
children | - | (collapsible: CollapsibleApi<PropTypes>) => ReactNode |
Trigger
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"button">) => Element) | undefinedRender the element yourself |
Indicator
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |
Content
| Property | Default | Type |
|---|---|---|
element | - | ((attributes: HTMLAttributes<"div">) => Element) | undefinedRender the element yourself |