v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

Collapsible

A single native disclosure with controlled or initial state.

Interactive preview

Advanced workspace settings

Only change this if your project needs a different alias.

Usage

import { Collapsible } from "@devvy-ui/react";

<Collapsible summary="Advanced settings"><p>Adjust these options for your workspace.</p></Collapsible>

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
summaryReactNoderequiredVisible disclosure trigger text.
open / defaultOpen / onOpenChangeboolean / boolean / callback— / false / —Controlled or initial expansion.
disabledbooleanfalseKeep the summary discoverable without activation.

Accessibility & behavior

Platform Behavior & Guidelines

Uses details/summary so closed content stays out of keyboard navigation. Enter/Space activate the native summary. Controlled requests wait for the caller. Do not add focusable controls inside the summary. onToggle and native details props remain available.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add collapsible

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

Collapsible.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.