Collapsible

An interactive component which expands/collapses a panel.

disclosureinteractive
Loading preview...

Installation

Terminal
npx baseui-cn add collapsible

The CLI installs styles/navigation.styles.css alongside the component. For manual installation, copy that stylesheet from the registry and keep the component import. It uses the existing semantic theme variables.

Usage

Code
import {
  Collapsible,
  CollapsiblePanel,
  CollapsibleTrigger,
} from "@/components/ui/collapsible"
Code
<Collapsible>
  <CollapsibleTrigger>Toggle</CollapsibleTrigger>
  <CollapsiblePanel>Content here.</CollapsiblePanel>
</Collapsible>

Note: Use Accordion for multiple collapsible panels with shared state. Collapsible is for a single standalone section.

Examples

Basic

A simple collapsible.

Loading preview...

Controlled

Control open state externally.

Loading preview...

Compact frame

Pair it with frame and button for settings sections, side panels, or inspector-style layouts.

Loading preview...

API Reference

See the Base UI Collapsible documentation for the full API reference, including all props, data attributes, and CSS classes.