Collapsible
collapsibleA section that opens and closes: a trigger, a panel, and a chevron that turns. The height is a CSS transition over the height Base UI measures, so the content inside keeps its own layout instead of being reflowed by a wrapper.
import {
Collapsible,
CollapsibleIndicator,
CollapsiblePanel,
CollapsibleTrigger,
} from "@/components/forme/collapsible/collapsible";
const FAQ = [
{
q: "Do I own the code after installing?",
a: "Yes. Every Forme item is copied into your project as source. There is no runtime package, no version to track, and nothing to remove later — edit it like anything else you wrote.",
},
{
q: "What happens when a component is updated?",
a: "You pull the new source when you want it. Nothing updates underneath you, so a change you did not ask for can never break a page you shipped.",
},
{
q: "Does it work with the App Router?",
a: "Server components are the default; only the parts that need state carry a client boundary, and it sits as low in the tree as the behaviour allows.",
},
];
export function CollapsibleDemo() {
return (
<div className="flex w-full max-w-md flex-col gap-6">
<Collapsible defaultOpen>
<CollapsibleTrigger>
Do I own the code after installing?
<CollapsibleIndicator />
</CollapsibleTrigger>
<CollapsiblePanel className="text-body-2-regular text-muted-foreground">
Yes. Every Forme item is copied into your project as source. There is no runtime package
and nothing to remove later.
</CollapsiblePanel>
</Collapsible>
<Collapsible>
<CollapsibleTrigger>
What happens when a component is updated?
<CollapsibleIndicator />
</CollapsibleTrigger>
<CollapsiblePanel className="text-body-2-regular text-muted-foreground">
You pull the new source when you want it. Nothing updates underneath you.
</CollapsiblePanel>
</Collapsible>
<div className="overflow-hidden rounded-xl border border-border bg-card">
{FAQ.map((entry, index) => (
<Collapsible key={entry.q} defaultOpen={index === 0}>
<CollapsibleTrigger className="rounded-none border-b border-border px-4 py-3">
{entry.q}
<CollapsibleIndicator />
</CollapsibleTrigger>
<CollapsiblePanel innerClassName="px-4" className="border-b border-border">
<p className="text-body-2-regular text-muted-foreground">{entry.a}</p>
</CollapsiblePanel>
</Collapsible>
))}
</div>
<Collapsible disabled>
<CollapsibleTrigger>
Disabled section
<CollapsibleIndicator />
</CollapsibleTrigger>
<CollapsiblePanel className="text-body-2-regular text-muted-foreground">
Never reached: the root is disabled.
</CollapsiblePanel>
</Collapsible>
</div>
);
}Install
Adds the component, its registry dependencies, and the token stylesheet you import once.
Usage
import {
Collapsible,
CollapsibleIndicator,
CollapsiblePanel,
CollapsibleTrigger,
} from "@/components/forme/collapsible/collapsible";
<Collapsible>
<CollapsibleTrigger>
What happens when a component is updated?
<CollapsibleIndicator />
</CollapsibleTrigger>
<CollapsiblePanel>You pull the new source when you want it.</CollapsiblePanel>
</Collapsible>When to use
Reach for it
- One section that hides detail until it is asked for: a FAQ answer, an advanced settings block, a long description.
- Several independent sections, stacked. Each owns its state, so more than one can be open at once.
Use something else
- A set where only one may be open — that is an
Accordion, which coordinates them. - Content that should always be visible; hiding one line behind a click costs more than it saves.
API reference
Read from the source, so it is the API of the file you install. A prop marked * is required.
CollapsibleTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | — | Render as the single child element instead of a <button>, keeping the trigger behaviour. |
Also takes every prop of Base UI Collapsible.Trigger.
CollapsiblePanel
The panel.
| Prop | Type | Default | Description |
|---|---|---|---|
innerClassName | string | — | Padding and layout for the content, inside the clipping wrapper. |
Also takes every prop of Base UI Collapsible.Panel.
The other parts
CollapsibleTakes Base UICollapsible.RootCollapsibleIndicatorTakes<span>attributes
Accessibility
- The trigger is a real
<button>witharia-expandedandaria-controls, so it is reachable and announced by the browser. - The panel unmounts when closed, keeping hidden content out of the tab order and out of find-in-page;
keepMountedorhiddenUntilFoundchange that trade deliberately.
Motion
- The panel's height is one CSS transition over
--collapsible-panel-height, so the content inside is never measured or pinned. - The chevron turns on the same duration, reading the open state from the trigger's
data-panel-open. - Reduced motion collapses the duration to nothing through the foundation's global rule — there is no branch to forget.
Related


Accordion
Collapsible sections on the Base UI primitive, with headings a screen reader can list, arrow-key navigation between triggers and a height that animates to the measured content.
layoutForme foundation
Design tokens, motion presets and the shared class-name helper every Forme component builds on.
layout

Card
A bordered surface with a header, title, description, content and footer you compose yourself, so a card is never more structure than the content inside it needs. Everything reads from the foundation tokens, which makes it retheme with the rest of the library.
layout