1. framework components
  2. collapsible

Collapsible

A container that can be expanded or collapsed to show or hide content.

Controlled

Indicator

Disabled

Alignment

Direction

API Reference

Root

txt
w-full data-[state=open]:space-y-2
PropDefaultType
idsPartial<{ root: string; content: string; trigger: string; }> | undefined

The ids of the elements in the collapsible. Useful for composition.

openboolean | undefined

The controlled open state of the collapsible.

defaultOpenboolean | 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.

onExitCompleteVoidFunction | undefined

The callback invoked when the exit animation completes.

disabledboolean | undefined

Whether the collapsible is disabled.

collapsedHeightstring | number | undefined

The height of the content when collapsed.

collapsedWidthstring | 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.

elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Provider

PropDefaultType
value() => CollapsibleApi<PropTypes>

elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Context

PropDefaultType
childrenSnippet<[() => CollapsibleApi<PropTypes>]>

Trigger

txt
data-disabled:opacity-50 data-disabled:pointer-events-none
PropDefaultType
elementSnippet<[HTMLAttributes<"button">]> | undefined

Render the element yourself

Indicator

PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

Content

PropDefaultType
elementSnippet<[HTMLAttributes<"div">]> | undefined

Render the element yourself

View page on GitHub