Collapsible

Single-item expand/collapse with smooth height animation. Lighter than Accordion when you just need one toggleable section — sidebar groups, advanced-options panels, FAQ items that don't need single-open enforcement.

Every primitive — Dialog, Popover, Combobox, DataTable, Toast — is implemented in this repo. No headless library to upgrade alongside React, no version mismatch when you bump.

Compatible by design. Tokens are plain CSS custom properties, every primitive accepts className and forwards refs.

GSAP is a peer dependency — you only pay the bundle cost when you import a motion primitive (Tilt, Ripple, ScrollReveal, etc.).

Usage

import { Collapsible } from '@bwo-ui/react';

<Collapsible trigger={<span>Advanced options</span>}>
  <Field label="Custom domain" />
  <Field label="Build command" />
</Collapsible>

// Controlled
const [open, setOpen] = useState(false);
<Collapsible trigger={...} open={open} onOpenChange={setOpen}>
  …
</Collapsible>

Props

PropTypeDefaultDescription
triggerReactNodeTrigger row content rendered inside the button.
defaultOpenbooleanfalseInitial open state (uncontrolled).
openbooleanControlled open state.
onOpenChange(open: boolean) => voidFires when the state changes.
durationnumber220Transition duration in ms.