Components

Collapsible

One panel that folds away behind a trigger. Minimal by design: the panel slides, and if you ask for it, writes a margin brace beside its text. The chevron indicator turns over the same way the accordion's does.

Install

terminal
npx shadcn@latest add @wobko/collapsible

First time here? Add the registry to components.json first. How to install

Examples

Starred repositories

The classic: a heading with a trigger button, one item always shown and the rest folded away. The panel slides open and shut.

Margin bracket and indicator

`bracket` writes a brace beside the opened text and lets it soak in; `CollapsibleIndicator` is the same chevron as the accordion's and turns over with the panel.

Show more

A composed card: the first three lines of a reading list are always there, the rest fold away behind a controlled trigger that says what it will do.

API reference

Collapsible

The Radix Collapsible root (also `group/collapsible`, for your own state-dependent classes).

PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => void-Controlled and uncontrolled state.
disabledbooleanfalseThe trigger stops toggling.

CollapsibleContent

The panel. It slides open and shut with a height animation that clips the text only while it moves, so a focus ring or ink bleed inside an open panel is never cut (upstream's animated `overflow-hidden` cuts it for good).

PropTypeDefaultDescription
bracket"curly" | "square" | falsefalseDraw a margin bracket beside the opened content and let the text soak in. Wraps the children in one element.

Accessibility

  • The trigger is a button with `aria-expanded` and `aria-controls`; Enter and Space toggle it. Closed content is not rendered.
  • Give the trigger a name: visible text, or a `sr-only` span when it is an icon button.
  • The brace and the chevron are decoration (aria-hidden); state is told by aria-expanded.
  • Reduced motion opens and closes the panel at once.

Source

The files the CLI copies into your project.

Loading the source