structyl

Collapsible

stable

An interactive component that expands / collapses a panel.

Basic usage

Examples

Controlled

Fully controlled open state with a dynamic toggle indicator.

Added keyboard support, reduced motion handling, and token-based styling.

Release notes disclosure

Use Collapsible for compact optional content with controlled or uncontrolled state.

Added searchable selects, multi-select values, and expanded component examples.

Features

  • Smooth height animation.
  • Controlled or uncontrolled.

Installation

bash
pnpm dlx structyl add collapsible

API Reference

Collapsible.Root

A single show/hide section.

PropTypeDefault
openboolean

Controlled open state.

defaultOpenboolean

Initial open state.

onOpenChange(open: boolean) => void

Called when open state changes.

disabledboolean

Disable the collapsible.

false

Collapsible.Trigger

Toggles the content.

PropTypeDefault
asChildboolean

Merge props onto the immediate child instead of rendering a default element.

false

Collapsible.Content

The collapsible region.

PropTypeDefault
forceMountboolean

Force mounting for animation control.

Collapsible | structyl