Collapsible

A region that expands and collapses. Compose three parts: Collapsible (state owner), CollapsibleTrigger (toggles it), and CollapsibleContent (the animated-height body).

Open state can be controlled (open + onOpenChange) or uncontrolled (defaultOpen). The trigger accepts asChild to reuse your own button/element.

@peduarte starred 3 repositories

@radix-ui/primitives
@radix-ui/colors
@stitches/react

Props

Collapsible

PropTypeDefaultDescription
openbooleanControlled open state. Omit for uncontrolled.
defaultOpenbooleanfalseInitial state when uncontrolled.
onOpenChange(open: boolean) => voidFired with the next state on toggle.
disabledbooleanfalseBlocks toggling.

CollapsibleTrigger

PropTypeDefaultDescription
asChildbooleanfalseRender the single child as the trigger, merging handlers/classes.

CollapsibleContent

PropTypeDefaultDescription
classNamestringClasses on the inner content element.