Content
- The trigger names what's inside, in sentence case: “Advanced”, “History on this list”, “Earlier meetings”.
A section people open and close, for what most people don't need most of the time.
import { … } from "@brdgapp/ui/components/collapsible"Collapsible is a section people open and close. Use it to tuck away what most people don't need most of the time: advanced settings, a history, extra detail. It comes in two looks: section, a heading with an arrow on the right, and inline, a small arrow before a line of words. It slides open, so what's below moves smoothly. The usual mistake is hiding something people need to finish the task.
The look comes from props
A component's appearance comes only from its own options (variant, size, color). className on a package component is for layout (mt-4, shrink-0, w-full), never for font size, color, padding, radius or hover. If the look needs a className, the component or the chosen option is wrong: fix that instead.
Leah Okonkwo · Sep 12
Trigger. A button. section: 13px bold --text-primary, full width. inline: 13px medium --text-secondary, as wide as its words.
Arrow. 16px, --text-muted. section: a down arrow on the right that flips up when open. inline: a right arrow before the words that turns down.
Count. Optional, section only. 12px --text-muted before the arrow: how many items are inside.
Content. What opens. It slides open and shut in 200ms. Its spacing is set where it's used (pt-3).
Open Advanced. The section slides open; the rare, risky action waits inside.
Google · contacts and calendar syncing
The count says how much is inside before anyone opens it.
The inline look: a small arrow before the words, for detail inside a block.
Saltmarsh Partners
On your Climate seed list · Intro requested
| Rest | Hover | Focus | Disabled | |
|---|---|---|---|---|
| Section, closed | ||||
| Section, open | ||||
| Inline, closed | ||||
| Inline, open |
| State | What happens |
|---|---|
| Closed | Arrow points down (section) or right (inline). The content isn't on the page. |
| Open | Arrow points up or down. The content shows. |
| Hover | section: the arrow darkens. inline: the words darken. |
| Focus | A soft blue ring around the trigger. |
| Disabled | 50% opacity; can't be opened. |
defaultOpen starts it open; open and onOpenChange let the screen hold the state.className is for layout only. Never a size or color.Do
Name the trigger for what's inside: “Advanced”, “History on this list”.Don't
Name it for the action: “Click to expand”, “Show more”.Do
Usesection for a heading over a block, inline for a line inside a block.Don't
Mix both looks in one list.Do
Tuck away a rare, risky action, like Disconnect account.Don't
Tuck away the main thing people came to do.aria-expanded) and which content it opens.| Keys | Action |
|---|---|
| EnterSpace | Opens or closes it. |
| Tab | Moves into the content when it's open, or past it when it's closed. |
Collapsible
Holds whether it's open. Extends Base UI Collapsible.Root props.
| Prop | Type | Default | Description |
|---|---|---|---|
defaultOpen | boolean | false | Start open. |
open | boolean | — | Open or not, when the screen holds the state. |
onOpenChange | (open: boolean) => void | — | Called when it opens or closes. |
disabled | boolean | false | Can't be opened. |
CollapsibleTrigger
The button that opens and closes it.
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "section" | "inline" | "section" | A heading with the arrow on the right, or a line with the arrow before it. |
count | number | — | section only: how many items are inside. |
children | ReactNode | — | The words: what's inside. |
className | string | — | Layout only. |
CollapsibleContent
What opens.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Layout only: pt-3, pl-5. |
What it's built from and where it's used, read from the code. When you change it, check these too.