Collapsible

Shows or hides one section with a native details disclosure.

Show the details
Quiet, on the grid.

Fold

Under the fold

A native disclosure. The law is one sentence.

The law
A poster you can install.

Use it for

  • One optional block the reader can reveal: details, advanced options, a long list.
  • defaultOpen when most readers want it open.

Not for

  • Several related sections; use Accordion.
  • Content everyone needs; leave it in the flow.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { Collapsible } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/collapsible.

2. Vendor the source

npx @noorddev/vlak-cli add collapsible

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/collapsible.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { Collapsible } from "@noorddev/vlak-react";

<Collapsible title="Show the details">Here they are.</Collapsible>
<Collapsible title="Advanced" open={open} onToggle={(e) => setOpen(e.currentTarget.open)}>…</Collapsible>

Collapsible

A bare native <details>.

PropTypeDefaultDescription
titlerequiredReactNode
defaultOpenboolean

Also accepts Omit<DetailsHTMLAttributes<HTMLDetailsElement>, "title">.

KeysDoes
TabMoves focus to the summary
Enter, SpaceOpens or closes it
<details class="rs-disclosure"><summary>Show the details<svg class="rs-acc-chevron" viewBox="0 0 16 16" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter"><g transform="rotate(90 8 8)"><path d="M5.5 3.5 L10.5 8 L5.5 12.5" vector-effect="non-scaling-stroke"/></g></svg></summary><div class="rs-disclosure-body">Here they are.</div></details>
.rs-disclosure.rs-disclosure-body.rs-disclosure-chevron.rs-disclosure-chevron-open.rs-disclosure-summary