Design System
Design System
Controlled
Control the active state of the component.
Indicator
Add a visual indicator to the toggle button.
Disabled
Set the disabled state for the component.
Alignment
Control the position and alignment of the trigger and content.
Direction
Set the text direction (ltr or rtl) using the dir prop.
API Reference
Root
w-full data-[state=open]:space-y-2| Prop | Default | Type |
|---|---|---|
ids | — | Partial<{ root: string; content: string; trigger: string; }> | undefined The ids of the elements in the collapsible. Useful for composition. |
open | — | boolean | undefined The controlled open state of the collapsible. |
defaultOpen | — | boolean | undefined The 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) | undefined The callback invoked when the open state changes. |
onExitComplete | — | VoidFunction | undefined The callback invoked when the exit animation completes. |
disabled | — | boolean | undefined Whether the collapsible is disabled. |
collapsedHeight | — | string | number | undefined The height of the content when collapsed. |
collapsedWidth | — | string | number | undefined The width of the content when collapsed. |
getRootNode | — | (() => ShadowRoot | Node | Document) | undefined A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
dir | "ltr" | "ltr" | "rtl" | undefined The document's text/writing direction. |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | CollapsibleApi<PropTypes> |
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | (collapsible: CollapsibleApi<PropTypes>) => ReactNode |
Trigger
data-disabled:opacity-50 data-disabled:pointer-events-none| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"button">) => Element) | undefined Render the element yourself |
Indicator
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Content
| Prop | Default | Type |
|---|---|---|
element | — | ((attributes: HTMLAttributes<"div">) => Element) | undefined Render the element yourself |
Root
w-full data-[state=open]:space-y-2| Prop | Default | Type |
|---|---|---|
ids | — | Partial<{ root: string; content: string; trigger: string; }> | undefined The ids of the elements in the collapsible. Useful for composition. |
open | — | boolean | undefined The controlled open state of the collapsible. |
defaultOpen | — | boolean | undefined The 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) | undefined The callback invoked when the open state changes. |
onExitComplete | — | VoidFunction | undefined The callback invoked when the exit animation completes. |
disabled | — | boolean | undefined Whether the collapsible is disabled. |
collapsedHeight | — | string | number | undefined The height of the content when collapsed. |
collapsedWidth | — | string | number | undefined The width of the content when collapsed. |
getRootNode | — | (() => ShadowRoot | Node | Document) | undefined A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron. |
dir | "ltr" | "ltr" | "rtl" | undefined The document's text/writing direction. |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Provider
| Prop | Default | Type |
|---|---|---|
value | — | () => CollapsibleApi<PropTypes> |
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Context
| Prop | Default | Type |
|---|---|---|
children | — | Snippet<[() => CollapsibleApi<PropTypes>]> |
Trigger
data-disabled:opacity-50 data-disabled:pointer-events-none| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"button">]> | undefined Render the element yourself |
Indicator
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |
Content
| Prop | Default | Type |
|---|---|---|
element | — | Snippet<[HTMLAttributes<"div">]> | undefined Render the element yourself |