Search documentation

Search the documentation and open a page.

An interactive component that expands and collapses a panel.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/collapsible

Composition

Collapsible ├── CollapsibleTrigger │ └── CollapsibleIndicator (optional) └── CollapsibleContent

Examples

Default

Loading...

Flight Details

Loading...

Order Summary

Loading...

Settings Panel

Loading...

API Reference

Collapsible

PropTypeDefaultDescription
idstring | undefined—Unique identifier used to connect the component parts.
idsElementIds | undefined—Overrides generated identifiers for individual parts.
openboolean | undefined—Whether the component is open when controlled.
defaultOpenboolean | undefined—Initial open state when uncontrolled.
onOpenChange((details: OpenChangeDetails) => void) | undefined—Runs when open changes.
onExitCompleteVoidFunction | undefined—Runs when exit complete changes.
disabledboolean | undefinedfalseDisables interaction with the component.
collapsedHeightnumber | string | undefined—Configures collapsed height.
collapsedWidthnumber | string | undefined—Configures collapsed width.

Context, Hooks, and Types

ExportAPI
CollapsibleContextRender-prop component that exposes component state and actions.
CollapsibleRootProviderProvides an externally created API to the component tree.
useCollapsibleCreates or accesses the component API.
useCollapsibleContextReturns the nearest component API.
CollapsibleOpenChangeDetailsType for the details object passed to the matching change callback.