Logobaseui-cn

Collapsible

An interactive component which expands/collapses a panel.

disclosureinteractive
Loading preview...

Installation

npx baseui-cn add collapsible

Usage

import {
  Collapsible,
  CollapsiblePanel,
  CollapsibleTrigger,
} from "@/components/ui/collapsible"
<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.