Collapsible

Opens and closes the section under a one-line row, for detail the reader may want.

Configurations

Supported configurations for this component.

States

Interaction states covered by the API and the style contract.

Configurations

5 examples
Closed
sm
md
Open

Read 3 sources on Q3 renewals and kept the two with dated figures.

sm

Read 3 sources on Q3 renewals and kept the two with dated figures.

md
Guide

Read 3 sources on Q3 renewals and kept the two with dated figures.

sm

Read 3 sources on Q3 renewals and kept the two with dated figures.

md
With meta
sm
md
Indicator override
sm
md

States

3 examples
Hover
Rest
Hover
Focus visible
Rest
Focus visible
Disabled

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

Collapsible

PropTypeDefaultDescription
openboolean-Controlled open state. Pair with onOpenChange.
defaultOpenbooleanfalseInitial open state when uncontrolled.
onOpenChange(open: boolean) => void-Called with the next open state when the trigger is pressed.
disabledbooleanfalseThe row cannot be toggled: dimmed to the disabled opacity, not-allowed cursor, no hover, no aria-expanded. The section keeps whatever state `open` gives it.
childrenReact.ReactNode-A CollapsibleTrigger followed by a CollapsibleContent.
classNamestring-Additional CSS classes applied to the root element.
styleReact.CSSProperties-Inline styles applied to the root element.

CollapsibleTrigger

PropTypeDefaultDescription
childrenreqReact.ReactNode-The row's label, set medium weight.
indicatorReact.ReactNode-Replaces the caret, e.g. a Spinner while the section has nothing in it yet. Drawn in a glyph-sized slot, aria-hidden.
metaReact.ReactNode-Trailing text pushed to the right edge in text.secondary: a duration, a count, a state word.
size'sm'|'md''sm'Row rung: 12 / 14px label, 16 / 18px caret, 8px gap.
onClick(event: React.MouseEvent<HTMLButtonElement>) => void-Runs before the toggle; call preventDefault to keep the row as it is.
classNamestring-Additional CSS classes applied to the root element.
styleReact.CSSProperties-Inline styles applied to the root element.

CollapsibleContent

PropTypeDefaultDescription
childrenReact.ReactNode-The section. Children stack in a column 12px apart.
guidebooleanfalseHang the section off a hairline rule under the caret (the step-trace look). Off, the section starts where the label starts.
classNamestring-Merged onto the section's box (the element that carries the padding and gap).
styleReact.CSSProperties-Merged onto the section's box.

More Andromeda Pro components