Collapsible
Pure disclosure mechanism — one trigger, one panel, no surface of its own, so every visible choice belongs to the caller.
Collapsible
Pure mechanism: it toggles visibility and nothing else. Every visible choice belongs to the children — compare Accordion, which is a collapsible plus an opinionated row.
Usage
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@oceanic-hub/brand-system'<Collapsible>
<CollapsibleTrigger>…</CollapsibleTrigger>
<CollapsibleContent>…</CollapsibleContent>
</Collapsible>Composition
Use the following composition to build a Collapsible:
Collapsible
├── CollapsibleTrigger
└── CollapsibleContentAccordion's own note ends: "for a single panel with a single trigger, use
Collapsible — it is the same disclosure without the roving stack." This is the other half of
that sentence. The moment there is more than one panel, or one might stay open while a reader
opens another, that is Accordion's job — this same disclosure with a heading rank, a divider
and the roving open-state stack built on top. Two primitives for two different shapes; reaching
for one where the other fits is not a styling choice, it is the wrong number of panels. And if
exactly one of several views should be showing at a time, neither of these is the shape — that
is Tabs.
It is unstyled by decision, not by omission: it toggles hidden and publishes
--radix-collapsible-content-height, and that is the whole surface. No border, no padding, no
chevron — Accordion is the opinionated sibling that adds those; here every visible choice
belongs to the children the caller puts inside CollapsibleContent.
No transition either, for the same reason. The owned scale exists —
animate-oc-expand/-collapse read this component's own variable — so staying bare is a
choice, not a gap: animating by default would be the one opinion a pure mechanism holds. A caller
who wants it to glide applies data-[state=open]:animate-oc-expand data-[state=closed]:animate-oc-collapse directly, and they work here natively rather than by
coincidence. Accordion is the sibling that already applies them.
Upstream's fifth example is Arabic, right-to-left — refused package-wide, not for this component
alone: recorded in pairings.json under direction, because nothing in this package has ever
been laid out or measured right-to-left. Two of upstream's remaining examples (an order panel, a
settings trigger) are the default demo's shape with different content, so they are not repeated
here; the "Nested" variant below covers the one shape they do not — a collapsible inside another,
which needs nothing extra because Radix primitives compose with themselves for free.
Disabled
disabled on the root makes the whole disclosure inert, trigger included — reach for it when a caller can see the section exists but cannot open it yet, not to hide it.
Nested
A collapsible inside another needs nothing extra — the export is a bare Radix re-export, and Radix primitives compose with themselves for free. A file tree is the canonical shape.
API Reference
See the Collapsible API page for every prop of every part, with types, defaults and the contract that pins them.