# Disclosure (Notchset): prompt.md (v1.2.0)

- id: `disclosure` · version 1.2.0 · component · free
- category: Navigation
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add https://notchset.dev/r/disclosure.json`
- npm dependencies: lucide-react@^1
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json, @notchset/reveal
- docs: https://notchset.dev/components/disclosure
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A heading that shows or hides what is under it: a turning chevron, the name, a quiet reading at the end, the panel growing into place. In a group (the accordion) arrows walk the headings; one panel opens at a time, or several with multiple. A custom trigger uses useDisclosure..

## Build it
- Stack: React 18.3 or 19, TypeScript, Tailwind CSS v4 utility classes on the foundation's roles, a components.json (imports use its aliases).
- Packages: `lucide-react@^1` beyond `react` and `react-dom`.
- Files: `components/ui/notchset/disclosure.tsx`, `components/ui/notchset/disclosure-parts.tsx`; shared code: `lib/notchset/controllable.ts`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`, `reveal`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `Disclosure`, `DisclosureGroup`, `DisclosureToggle`, `StepList`, `disclosureScope`, `disclosureTrigger`, `useDisclosure`, `DisclosureScope`, `partId`, and every exported type.
- CSS: the install adds the notchset foundation (its roles, keyframes and motion switch, reading your shadcn tokens for colour) to your global stylesheet once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- This item reads `--ns-btn-ok`, `--ns-btn-roll`, `--ns-control`, `--ns-control-sm`, `--ns-ease-move`, `--ns-hover`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-leading-prose`, `--ns-line`, `--ns-radius`, `--ns-radius-sm`, `--ns-raised`, `--ns-signal`, `--ns-text-body`, `--ns-text-meta`, `--ns-text-small`, `--ns-text-sub`, `--ns-time-color`, `--ns-time-menu`, `--ns-time-snap`, `--ns-weight-medium`, `--ns-weight-regular`.
- Retune it (on any ancestor) with the foundation's roles and hooks: `--ns-agent-b`, `--ns-agent-c`, `--ns-agent-d`, `--ns-agent-drift`, `--ns-agent-fill`, `--ns-agent-h1`, `--ns-agent-h2`, `--ns-agent-h3`, `--ns-agent-shift`, `--ns-avatar-card`, `--ns-avatar-lg`, `--ns-avatar-md`, `--ns-avatar-sm`, `--ns-avatar-xs`, `--ns-bad`, `--ns-bad-ink`, `--ns-band`, `--ns-band-edge`, `--ns-band-grade`, `--ns-band-optimal`, `--ns-banner-beat`, `--ns-banner-radius`, `--ns-beat`, `--ns-beat-ease`, `--ns-bezel`, `--ns-bloom-close`, `--ns-bloom-open`, `--ns-bloom-rise`, `--ns-btn-bad`, `--ns-btn-bad-hover`, `--ns-btn-bad-line`, `--ns-btn-bezel`, `--ns-btn-chosen`, `--ns-btn-gone`, `--ns-btn-morph`, `--ns-btn-ok`, `--ns-btn-press`, `--ns-btn-release`, `--ns-btn-result`, `--ns-btn-roll`, `--ns-btn-stagger`, `--ns-btn-stagger-step`, `--ns-btn-tick`, `--ns-btn-tonal`, `--ns-btn-tonal-edge`, `--ns-btn-tonal-hover`, `--ns-bulk-clear`, `--ns-button`, `--ns-button-field-inset`, `--ns-button-lg`, `--ns-button-sm`, `--ns-canvas`, `--ns-card-tilt`, `--ns-cat-1`, `--ns-cat-2`, `--ns-cat-3`, `--ns-cat-4`, `--ns-cat-5`, `--ns-cat-6`, `--ns-check`, `--ns-check-round`, `--ns-cheer-1`, `--ns-cheer-2`, `--ns-cheer-3`, `--ns-cheer-edge`, `--ns-cheer-fold`, `--ns-cheer-glow`, `--ns-cheer-lift`, `--ns-chip`, `--ns-chip-pick`, `--ns-control`, `--ns-control-lg`, `--ns-control-pad`, `--ns-control-sm`, `--ns-corner`, `--ns-danger`, `--ns-deep`, `--ns-deep-ink`, `--ns-deep-ink-2`, `--ns-deep-line`, `--ns-depth-card`, `--ns-depth-lift`, `--ns-depth-surface`, `--ns-dialog`, `--ns-dialog-grow`, `--ns-dialog-lg`, `--ns-dialog-max`, `--ns-dialog-shrink`, `--ns-dialog-sm`, `--ns-dialog-top`, `--ns-dock-bottom`, `--ns-drop`, `--ns-ease`, `--ns-ease-arrive`, `--ns-ease-breathe`, `--ns-ease-drum`, `--ns-ease-exit`, `--ns-ease-fling`, `--ns-ease-glide`, `--ns-ease-grow`, `--ns-ease-move`, `--ns-ease-panel`, `--ns-ease-pop`, `--ns-ease-press`, `--ns-ease-spring`, `--ns-ebg-arm`, `--ns-ebg-lit`, `--ns-emoji`, `--ns-emoji-md`, `--ns-emoji-sm`, `--ns-field`, `--ns-field-edge`, `--ns-field-h`, `--ns-fill`, `--ns-fill-time`, `--ns-flood-arc`, `--ns-flood-aurora`, `--ns-flood-behind-1`, `--ns-flood-behind-2`, `--ns-flood-bloom`, `--ns-flood-deep`, `--ns-flood-dial-bloom`, `--ns-flood-glass`, `--ns-flood-grain`, `--ns-flood-image`, `--ns-flood-ink`, `--ns-flood-ink-low`, `--ns-flood-light`, `--ns-flood-mid`, `--ns-flood-pale`, `--ns-flood-pane`, `--ns-flood-pane-edge`, `--ns-flood-pill-ink`, `--ns-flood-ribbon`, `--ns-flood-ribbon-core`, `--ns-flood-shadow`, `--ns-flood-sheen`, `--ns-flood-wash`, `--ns-font-body`, `--ns-font-display`, `--ns-font-mono`, `--ns-font-script`, `--ns-glass`, `--ns-glass-blur`, `--ns-glass-shadow`, `--ns-glow`, `--ns-glyph-pad`, `--ns-grain`, `--ns-gutter`, `--ns-header`, `--ns-help-max`, `--ns-hit`, `--ns-hover`, `--ns-icon`, `--ns-icon-lg`, `--ns-icon-sm`, `--ns-icon-stroke`, `--ns-info`, `--ns-info-ink`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-ink-4`, `--ns-layer-bar`, `--ns-layer-modal`, `--ns-layer-panel`, `--ns-layer-popup`, `--ns-layer-sticky`, `--ns-layer-tip`, `--ns-layer-toast`, `--ns-layer-zoom`, `--ns-lead-body`, `--ns-lead-figure`, `--ns-lead-large`, `--ns-lead-meta`, `--ns-lead-small`, `--ns-lead-sub`, `--ns-lead-title`, `--ns-leading`, `--ns-leading-prose`, `--ns-leading-title`, `--ns-lift`, `--ns-light-1`, `--ns-light-2`, `--ns-light-3`, `--ns-light-spread`, `--ns-light-strength`, `--ns-line`, `--ns-line-soft`, `--ns-lit-edge`, `--ns-map-grass`, `--ns-map-water`, `--ns-mark-edge`, `--ns-mark-lifted`, `--ns-mark-rest`, `--ns-mark-swap`, `--ns-marker`, `--ns-marker-ink`, `--ns-mc-place`, `--ns-mc-roll`, `--ns-measure`, `--ns-menu-dy`, `--ns-menu-lit`, `--ns-menu-pad`, `--ns-menu-row`, `--ns-menu-rule`, `--ns-mesh`, `--ns-mesh-frost`, `--ns-nest-inset`, `--ns-nest-outer`, `--ns-nest-r`, `--ns-notch-ease`, `--ns-ok`, `--ns-ok-ink`, `--ns-on-fill`, `--ns-orb-body`, `--ns-orb-cool`, `--ns-orb-core`, `--ns-orb-dawn`, `--ns-orb-deep`, `--ns-orb-edge`, `--ns-orb-grain`, `--ns-orb-ground`, `--ns-orb-halo`, `--ns-orb-inner`, `--ns-orb-key`, `--ns-orb-lift`, `--ns-orb-limb`, `--ns-orb-limb-from`, `--ns-orb-rim`, `--ns-orb-skin-hi`, `--ns-orb-skin-lo`, `--ns-orb-skin-mid`, `--ns-orb-warm`, `--ns-palette-min`, `--ns-panel`, `--ns-panel-room`, `--ns-panel-w`, `--ns-panel-w-lg`, `--ns-pick-slot`, `--ns-pill-prop`, `--ns-play-fill`, `--ns-play-fill-color`, `--ns-play-lift`, `--ns-play-lift-y`, `--ns-play-open`, `--ns-play-open-content`, `--ns-play-press`, `--ns-play-press-box`, `--ns-play-reduced`, `--ns-play-ring`, `--ns-play-roll`, `--ns-play-shake`, `--ns-play-spring`, `--ns-play-swap`, `--ns-play-swap-blur`, `--ns-press-min`, `--ns-press-scale`, `--ns-press-x`, `--ns-press-y`, `--ns-primary-hover`, `--ns-primary-press`, `--ns-prism-edge`, `--ns-prism-glint`, `--ns-prism-sheen`, `--ns-prism-tint`, `--ns-pulse`, `--ns-radius`, `--ns-radius-2xl`, `--ns-radius-button`, `--ns-radius-button-lg`, `--ns-radius-button-sm`, `--ns-radius-card`, `--ns-radius-check`, `--ns-radius-control`, `--ns-radius-control-sm`, `--ns-radius-float`, `--ns-radius-full`, `--ns-radius-lg`, `--ns-radius-mark`, `--ns-radius-menu-row`, `--ns-radius-modal`, `--ns-radius-pill`, `--ns-radius-sm`, `--ns-radius-xl`, `--ns-radius-xs`, `--ns-raised`, `--ns-ramp-1`, `--ns-ramp-2`, `--ns-ramp-3`, `--ns-ramp-4`, `--ns-ramp-5`, `--ns-ramp-shine`, `--ns-range`, `--ns-rest-1`, `--ns-rest-2`, `--ns-rest-3`, `--ns-rise`, `--ns-row`, `--ns-row-compact`, `--ns-row-hue`, `--ns-scrim`, `--ns-search-h`, `--ns-segment`, `--ns-segment-inset`, `--ns-segment-lift`, `--ns-segment-sm`, `--ns-selected`, `--ns-series`, `--ns-series-core`, `--ns-series-glint`, `--ns-series-tint`, `--ns-shadow-dialog`, `--ns-shadow-float`, `--ns-shadow-lift`, `--ns-shadow-panel`, `--ns-sheet`, `--ns-sheet-back`, `--ns-sheet-bottom`, `--ns-sheet-drop`, `--ns-sheet-rise`, `--ns-shift`, `--ns-side`, `--ns-signal`, `--ns-signal-ink`, `--ns-signal-wash`, `--ns-sk-figure`, `--ns-sk-land`, `--ns-sk-p`, `--ns-sk-p0`, `--ns-sk-p1`, `--ns-sk-p2`, `--ns-sk-p3`, `--ns-sk-p4`, `--ns-sk-p5`, `--ns-sk-p6`, `--ns-sk-p7`, `--ns-sk-read`, `--ns-sk-sweep`, `--ns-skeleton`, `--ns-skeleton-bone`, `--ns-skeleton-bone-light`, `--ns-skeleton-light`, `--ns-slab`, `--ns-slab-edge`, `--ns-slab-ink`, `--ns-sleep-awake`, `--ns-sleep-deep`, `--ns-sleep-light`, `--ns-sleep-rem`, `--ns-space-1`, `--ns-space-2`, `--ns-space-3`, `--ns-space-4`, `--ns-space-5`, `--ns-space-6`, `--ns-space-8`, `--ns-space-section`, `--ns-stack-fan`, `--ns-stack-fan-gap`, `--ns-stack-fan-lag`, `--ns-stack-on`, `--ns-stagger-item`, `--ns-stagger-mark`, `--ns-stagger-max`, `--ns-standing-critical`, `--ns-standing-in`, `--ns-standing-out`, `--ns-state-doing`, `--ns-state-done`, `--ns-state-review`, `--ns-state-todo`, `--ns-step`, `--ns-step-from`, `--ns-step-sign`, `--ns-swipe-surface`, `--ns-switch-h`, `--ns-switch-w`, `--ns-text-body`, `--ns-text-control`, `--ns-text-control-lg`, `--ns-text-display`, `--ns-text-editorial`, `--ns-text-empty`, `--ns-text-figure`, `--ns-text-giant`, `--ns-text-heading`, `--ns-text-headline`, `--ns-text-input`, `--ns-text-large`, `--ns-text-lede`, `--ns-text-meta`, `--ns-text-record`, `--ns-text-sentence`, `--ns-text-small`, `--ns-text-sub`, `--ns-text-title`, `--ns-theme-fade`, `--ns-tile-shadow`, `--ns-time-born`, `--ns-time-color`, `--ns-time-confirm`, `--ns-time-dialog`, `--ns-time-fling`, `--ns-time-flip`, `--ns-time-glide`, `--ns-time-grow`, `--ns-time-hold`, `--ns-time-menu`, `--ns-time-page`, `--ns-time-panel`, `--ns-time-quick`, `--ns-time-roll`, `--ns-time-settle`, `--ns-time-snap`, `--ns-time-spin`, `--ns-time-spring`, `--ns-time-sweep`, `--ns-time-toast`, `--ns-tint`, `--ns-tint-c`, `--ns-tint-ease`, `--ns-tint-fill`, `--ns-tint-gap`, `--ns-tint-h1`, `--ns-tint-h2`, `--ns-tint-h3`, `--ns-tint-ink`, `--ns-tint-row`, `--ns-tip-fold`, `--ns-tip-grow`, `--ns-toast-bottom`, `--ns-toast-gap`, `--ns-toast-left`, `--ns-toast-lift`, `--ns-toast-peek`, `--ns-toast-scale`, `--ns-toast-w`, `--ns-touch`, `--ns-tracking-body`, `--ns-tracking-caps`, `--ns-tracking-control`, `--ns-tracking-display`, `--ns-tracking-headline`, `--ns-tracking-sub`, `--ns-tracking-title`, `--ns-warn`, `--ns-warn-ink`, `--ns-wash-clay`, `--ns-wash-dusk`, `--ns-wash-graphite`, `--ns-wash-ink`, `--ns-wash-sage`, `--ns-wash-sand`, `--ns-weight-light`, `--ns-weight-medium`, `--ns-weight-regular`, `--ns-weight-strong`, `--ns-well`, `--ns-width-lg`, `--ns-width-md`, `--ns-width-sm`, `--ns-width-xl`.
- Never add Tailwind colour classes inside the component.

```tsx
import { Avatar } from "@/components/ui/notchset/avatar";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/disclosure.tsx`, `components/ui/notchset/disclosure-parts.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- Content the person opens to read, under a name that says what it is (questions, details, a folded group).

### Not when
- A row your own action adds is Reveal; a few views of one thing are Tabs; a list too long to read is Pagination; things inside things are Tree view.

## Built from
- reveal (`reveal`), installed with it: reuse it, don't rebuild it
- Controllable (shared helper, ships with it)
- Icons (shared helper, ships with it)
- Motion (shared helper, ships with it)

## Mistakes
- Hiding the one thing the person came for behind it: show it open, or don't fold it
- A row of views of one thing: that is Tabs
- Nesting a group inside a group's panel: two levels of chevrons read as a tree

## Usage

```tsx
"use client";
import * as React from "react";
import { Avatar } from "@/components/ui/notchset/avatar";
import { CompanyMark } from "@/components/ui/notchset/company-mark";
import { Disclosure, DisclosureGroup, StepList } from "@/components/ui/notchset/disclosure";
import { brandGlyph } from "./brands";
import { useLessMotion } from "@/lib/notchset/motion";
import { pressIn, useSelfPlay } from "./self-play";

/*
 * What Scout did, clean by default and in detail on demand. Receipt: one receipt with "Show 4 steps" under its line;
 * the press grows the steps down under it (nothing above moves), each falling into place with its green done tick
 * drawing, and the words roll to "Hide steps". Group: Scout's receipts as one card of rows, one open at a time
 * (opening one folds the other); ↑ and ↓ walk the rows. On arrival the first one opens once, then folds; less motion
 * shows it folded.
 */
const REFUND = {
  id: "refund",
  title: "Scout refunded $48 to Revolut",
  line: "For Maria Costa · order 5521 · 10:42",
  steps: [
    { text: "Read Maria Costa's note about a double charge", time: "10:41" },
    { text: "Found two $48 charges on order 5521", time: "10:41" },
    { text: "Refunded the second one through Stripe", time: "10:42" },
    { text: "Emailed Maria the refund receipt", time: "10:42" },
  ],
};
const RECEIPTS = [
  REFUND,
  {
    id: "vercel",
    title: "Scout moved Vercel to Negotiation",
    line: "From Priya Raman's call notes · 11:05",
    steps: [
      { text: "Read the notes from Priya Raman's call", time: "11:04" },
      { text: "Saw 40 more seats agreed in principle", time: "11:04" },
      { text: "Moved the deal from Proposal to Negotiation", time: "11:05" },
    ],
  },
  {
    id: "reply",
    title: "Scout drafted a reply to Claire Dubois",
    line: "About single sign-on · 11:20",
    steps: [
      { text: "Read Claire Dubois's question about SSO", time: "11:18" },
      { text: "Found the answer in the Notion handbook", time: "11:19" },
      { text: "Left the draft in your inbox to send", time: "11:20" },
    ],
  },
];
const CARD = "w-[420px] max-w-full rounded-[var(--ns-radius-xl)] bg-[var(--ns-raised)] shadow-[inset_0_0_0_1px_var(--ns-line)]";

export default function DisclosureDemo() {
  const title = REFUND.title;
  const use = ("toggle" as string) === "header" ? "header" : "toggle";
  const root = React.useRef<HTMLDivElement>(null);
  const less = useLessMotion();
  const play = useSelfPlay(root, { beats: [0, 1200], off: less });
  /* the moment: the first trigger opens once and the detail grows down under it */
  React.useEffect(() => {
    if (play.mine) return;
    if (play.step === 0) pressIn(root.current, "button[aria-expanded='false']");
    if (play.step === 1) pressIn(root.current, "button[aria-expanded='true']");
  }, [play.step, play.mine]);
  const hand = { ref: root, onPointerDownCapture: play.handOver, onKeyDownCapture: play.handOver };
  if (use === "header")
    return (
      <div {...hand} className="flex w-full justify-center">
        <DisclosureGroup label="Scout's receipts" className={`${CARD} [&>*]:py-0`}>
          {RECEIPTS.map((r, i) => (
            <Disclosure key={r.id} value={r.id} variant="header" headingLevel={3} lead={<Avatar variant="agent" name="Scout" className="!size-6" />} summary={i === 0 ? title : r.title} line={r.line}>
              <StepList steps={r.steps} label={`What Scout did: ${r.steps.length} steps, all done`} />
            </Disclosure>
          ))}
        </DisclosureGroup>
      </div>
    );
  return (
    <div {...hand} className="flex w-full justify-center">
      <div className={`${CARD} p-4`}>
        <div className="flex items-start gap-3">
          <Avatar variant="agent" name="Scout" className="!size-7" />
          <div className="min-w-0 flex-1">
            <div className="text-[length:var(--ns-text-body)] leading-5 font-[number:var(--ns-weight-medium)] text-[var(--ns-ink)]">{title}</div>
            <div className="text-[length:var(--ns-text-meta)] leading-4 text-[var(--ns-ink-3)]">{REFUND.line}</div>
            <div className="mt-2 flex flex-col">
              <Disclosure variant="toggle" summary={`Show ${REFUND.steps.length} steps`} openSummary="Hide steps">
                <StepList steps={REFUND.steps} label={`What Scout did: ${REFUND.steps.length} steps, all done`} />
              </Disclosure>
            </div>
          </div>
          <CompanyMark name="Revolut" color="#191c1f" glyph={brandGlyph("revolut")} size="sm" className="mt-1" />
        </div>
      </div>
    </div>
  );
}
```

This example also uses `avatar` (https://notchset.dev/components/avatar), `company-mark` (https://notchset.dev/components/company-mark). Installing this item doesn't bring them; to paste the example as it is: `npx shadcn@latest add https://notchset.dev/r/disclosure.json https://notchset.dev/r/avatar.json https://notchset.dev/r/company-mark.json`.

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `open` | `boolean` |  | Controlled: open or closed. |
| `defaultOpen` | `boolean` |  | Uncontrolled: how it starts. |
| `onOpenChange` | `(open: boolean) => void` |  | Called with the new state on every press. |
| `summary` | `React.ReactNode` |  | What the trigger says: the name of what it holds. |
| `meta` | `React.ReactNode` |  | A short trailing reading on the trigger (a count, a total); it stays visible open or closed. |
| `value` | `string` |  | In a DisclosureGroup: this panel's key (the group opens and closes it by this). |
| `headingLevel` | `2 \| 3 \| 4 \| 5 \| 6` |  | Wraps the trigger in a heading of this level, so the panel is a section in the page outline. |
| `size` | `"md" \| "lg"` | `"md"` | lg: a page's questions, at sub-heading size with a 56px row (default md: a 36px row in a card or a list). |
| `disabled` | `boolean` |  | Not pressable; the panel keeps the state it has. |
| `variant` | `"row" \| "toggle" \| "header"` | `"row"` | row (the default): a row with a turning chevron at its start. toggle: a quiet text button with a chevron after its words, the panel under it (a receipt's "Show 4 steps"). header: a card's row, `lead` before a title and its `line`, the chevron at the end (DisclosureGroup's receipts). |
| `openSummary` | `React.ReactNode` |  | What the trigger says while it is open ("Hide steps"); the words roll between the two. |
| `lead` | `React.ReactNode` |  | header: what leads the row (an agent's orb, a mark). |
| `line` | `React.ReactNode` |  | header: one quieter line under the title. |

Full docs: https://notchset.dev/components/disclosure

## Customising
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- Dark mode follows the `.dark` class or `data-theme="dark"` on an ancestor (the shadcn and next-themes conventions).
- Update later: Commit or stash local changes first (or copy the files), so the update can be undone. Read https://notchset.dev/r/changelog.json for the new versions: a major version, an entry marked breaking or a merge says what to change. Then re-run the install with `--overwrite`, on a branch. It replaces the component's files, the shared helper files they import, and the item's CSS rules in the global stylesheet, so review the whole diff (components, shared files, CSS), re-apply your own edits, and run the app's typecheck, tests and build.

## Keyboard

| Keys | Action |
|---|---|
| Enter or Space | open or close the panel |
| ↑ ↓ | in a group, the previous or next heading |
| Home End | in a group, the first or last heading |

## Performance

- A button and a region per panel; the panel's height comes from the grid, never measured.
- A closed panel stays in the page (inert), so a long page of questions costs its content once.

## Responsive

- phone and desktop (the trigger is a full-width 36px row)
- dark (tokens)
- right to left: the closed chevron points the reading way
- reduced motion: the panel swaps at once

## Motion inventory

| Interaction | What moves |
|---|---|
| the row's label swaps between open and shut | ns-play-swap-in on --ns-btn-roll, --ns-ease-move (data-ns-play). Reduced motion: a short fade (data-ns-play). |
| its steps fall 6px into place one by one as it opens, each green done tick drawing and each length of rail drawing down to the next; they leave in reverse as it shuts | Web Animations in disclosure.tsx: 260ms on --ns-ease-move, 30ms apart; ticks 280ms, rails 180ms. Reduced motion: they are there at once. |
| the panel grows into place and folds away; the chevron turns | Reveal (grid-template-rows on --ns-time-panel and --ns-ease-panel, opacity on --ns-ease); the chevron's rotate on --ns-time-menu and --ns-ease-move. Reduced motion: swaps at once and the chevron turns at once (data-ns-glide). |
| press: the row sinks a little and springs back | data-ns-press: down to --ns-press-scale (0.99 here, a full-width row) in --ns-time-quick on --ns-ease-press, back in --ns-time-spring on --ns-ease-spring; colours on --ns-time-color. Reduced motion: no scale under either switch; the colour still changes. |

## Accessibility contract (preserve when editing)
- The trigger is a button with aria-expanded and aria-controls; the panel is a region named by its trigger, inert and hidden while closed. headingLevel wraps the trigger in a heading.
- In a group: ↑ and ↓ move between the headings (wrapping), Home and End reach the first and last, Enter or Space opens one.

## Install

```bash
# npm
npx shadcn@latest add https://notchset.dev/r/disclosure.json
# pnpm
pnpm dlx shadcn@latest add https://notchset.dev/r/disclosure.json
# yarn
yarn dlx shadcn@latest add https://notchset.dev/r/disclosure.json
# bun
bunx --bun shadcn@latest add https://notchset.dev/r/disclosure.json
```

Or add the `@notchset` registry to components.json and run `npx shadcn@latest add @notchset/disclosure`. Every components.json style gets the same files.

### Manual

1. Install the packages: `npm install lucide-react@^1`.
2. Copy `components/ui/notchset/disclosure.tsx`, `lib/notchset/controllable.ts`, `components/ui/notchset/disclosure-parts.tsx`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts` from https://notchset.dev/r/disclosure.json (each file's `content`, at its `target`), keeping the `@/` path alias of your tsconfig.
3. Add what it builds on: shadcn `utils` (cn), `notchset-foundation`, `reveal`.

## Continue the workflow

- [Breadcrumb and back](https://notchset.dev/components/breadcrumb)
- [Help menu](https://notchset.dev/components/help-menu)
- [Nav pill](https://notchset.dev/components/nav-pill)

## Source

### components/ui/notchset/disclosure.tsx

```tsx
// Notchset disclosure 1.2.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { ChevronDown, ChevronRight } from "@/lib/notchset/icons";
import { cn } from "@/lib/utils";
import { useControllable } from "@/lib/notchset/controllable";
import { disclosureScope, disclosureTrigger, useDisclosure, type OpenProps } from "@/components/ui/notchset/disclosure-parts";
import { Reveal } from "@/components/ui/notchset/reveal";
import { lessMotion } from "@/lib/notchset/motion";

const useIsomorphicLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;
const STAGGER = 30;

/* inside a panel as it opens: its steps fall into place one by one, each done tick draws and each length of rail draws
   down to the next; as it shuts they leave in reverse, the last first */
function unfold(panel: HTMLElement, open: boolean) {
  const rows = [...panel.querySelectorAll<HTMLElement>("[data-step]")];
  if (!rows.length || typeof rows[0]!.animate !== "function" || lessMotion(panel)) return;
  const ticks = [...panel.querySelectorAll<SVGPathElement>("[data-tick]")];
  const rails = [...panel.querySelectorAll<HTMLElement>("[data-rail]")];
  [...rows, ...ticks, ...rails].forEach((x) => x.getAnimations().forEach((a) => a.cancel()));
  const ease = "cubic-bezier(.5,0,.2,1)";
  if (open) {
    rows.forEach((r, i) => r.animate([{ opacity: 0, translate: "0 -6px" }, { opacity: 1, translate: "0 0" }], { duration: 260, delay: 40 + i * STAGGER, easing: ease, fill: "backwards" }));
    ticks.forEach((t, i) => t.animate([{ strokeDashoffset: 1 }, { strokeDashoffset: 0 }], { duration: 280, delay: 140 + i * STAGGER * 2, easing: ease, fill: "backwards" }));
    rails.forEach((r, i) => r.animate([{ scale: "1 0" }, { scale: "1 1" }], { duration: 180, delay: 160 + i * STAGGER * 2, easing: ease, fill: "backwards" }));
    return;
  }
  const n = rows.length;
  rows.forEach((r, i) => r.animate([{ opacity: 1, translate: "0 0" }, { opacity: 0, translate: "0 -4px" }], { duration: 160, delay: (n - 1 - i) * STAGGER, easing: "ease-in", fill: "forwards" }));
  rails.forEach((r, i) => r.animate([{ scale: "1 1" }, { scale: "1 0" }], { duration: 120, delay: Math.max(0, n - 2 - i) * STAGGER, easing: "ease-in", fill: "forwards" }));
}

/* plays unfold on the panel `id` after the first paint, each time `open` changes */
function useUnfold(id: string, open: boolean) {
  const was = React.useRef(open);
  useIsomorphicLayoutEffect(() => {
    if (was.current === open) return;
    was.current = open;
    const panel = document.getElementById(id);
    if (panel) unfold(panel, open);
  }, [id, open]);
}

type Step = { text: React.ReactNode; time?: React.ReactNode };
/** what a screen reader hears before each step */
const STEP_LIST_LABELS = { done: "Done:" };

/**
 * What an agent or a person did, in order, each step done: a green tick on a soft green disc, the words, the time. A
 * thin rail joins each tick to the next. Inside a Disclosure the steps fall into place as it opens and the ticks draw.
 */
function StepList({ steps, label, className }: { steps: readonly Step[]; label?: string | undefined; className?: string | undefined }) {
  return (
    <ol data-slot="step-list" aria-label={label} className={cn("relative m-0 list-none p-0", className)}>
      {steps.map((st, i) => (
        <li key={i} data-step="" className="relative flex min-h-9 items-start gap-3 py-2">
          {i < steps.length - 1 ? <span data-rail="" aria-hidden className="absolute start-[7.5px] top-[27px] -bottom-[7px] w-px origin-top bg-[color-mix(in_oklab,var(--ns-btn-ok)_28%,transparent)]" /> : null}
          <span className="relative mt-px inline-grid size-4 shrink-0 place-items-center rounded-full bg-[color-mix(in_oklab,var(--ns-btn-ok)_12%,var(--ns-raised))] text-[var(--ns-btn-ok)]">
            <svg viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth={1.9} strokeLinecap="round" strokeLinejoin="round" aria-hidden className="size-3">
              <path data-tick="" d="M3.5 8.6 6.6 11.6 12.6 4.6" pathLength={1} strokeDasharray={1} />
            </svg>
          </span>
          <span className="sr-only">{STEP_LIST_LABELS.done} </span>
          <span className="min-w-0 flex-1 text-[length:var(--ns-text-small)] leading-[18px] text-[var(--ns-ink-2)]">{st.text}</span>
          {st.time !== undefined && <span className="shrink-0 text-[length:var(--ns-text-meta)] leading-[18px] text-[var(--ns-ink-3)] tabular-nums">{st.time}</span>}
        </li>
      ))}
    </ol>
  );
}

/*
 * Disclosure: a heading the person presses to show or hide what sits under it. The trigger is a real button, says
 * whether it is open, and points at the panel it controls; the panel grows into place (Reveal), and a closed panel is
 * inert. A DisclosureGroup is the accordion: arrow keys move between triggers (Home and End jump), and with `multiple`
 * off only one panel is open at a time.
 *
 * A trigger with its own look uses the same contract through useDisclosure: spread `trigger` on the button and `panel`
 * on what it shows. In a list of rows, disclosureTrigger gives one row's button the same attributes from state the list
 * holds. A disclosure that opens over its own place spreads `scope` on the element holding both: Escape folds it and
 * puts focus back on the trigger.
 */

type GroupCtx = { isOpen: (value: string) => boolean; toggle: (value: string) => void };
const Group = React.createContext<GroupCtx | null>(null);

type DisclosureProps = OpenProps & {
  /** What the trigger says: the name of what it holds. */
  summary: React.ReactNode;
  /** A short trailing reading on the trigger (a count, a total); it stays visible open or closed. */
  meta?: React.ReactNode;
  /** In a DisclosureGroup: this panel's key (the group opens and closes it by this). */
  value?: string | undefined;
  /** Wraps the trigger in a heading of this level, so the panel is a section in the page outline. */
  headingLevel?: 2 | 3 | 4 | 5 | 6 | undefined;
  /** lg: a page's questions, at sub-heading size with a 56px row (default md: a 36px row in a card or a list). */
  size?: "md" | "lg" | undefined;
  /** Not pressable; the panel keeps the state it has. */
  disabled?: boolean | undefined;
  /**
   * row (the default): a row with a turning chevron at its start. toggle: a quiet text button with a chevron after its
   * words, the panel under it (a receipt's "Show 4 steps"). header: a card's row, `lead` before a title and its `line`,
   * the chevron at the end (DisclosureGroup's receipts).
   */
  variant?: "row" | "toggle" | "header" | undefined;
  /** What the trigger says while it is open ("Hide steps"); the words roll between the two. */
  openSummary?: React.ReactNode;
  /** header: what leads the row (an agent's orb, a mark). */
  lead?: React.ReactNode;
  /** header: one quieter line under the title. */
  line?: React.ReactNode;
  children: React.ReactNode;
  className?: string | undefined;
};

function Disclosure({ summary, meta, value, headingLevel, size = "md", disabled, variant = "row", openSummary, lead, line, children, className, ...openProps }: DisclosureProps) {
  const group = React.useContext(Group);
  const inGroup = !!group && value !== undefined;
  const own = useDisclosure(openProps);
  const open = inGroup ? group.isOpen(value) : own.open;
  const toggle = inGroup ? () => group.toggle(value) : own.toggle;
  const id = own.panel.id;
  const triggerId = `${id}-t`;
  useUnfold(id, open);
  const words = openSummary !== undefined ? (
    <span key={open ? "open" : "shut"} data-ns-play="" className="[animation:ns-play-swap-in_var(--ns-btn-roll)_var(--ns-ease-move)_both]">
      {open ? openSummary : summary}
    </span>
  ) : (
    summary
  );
  const turn = <ChevronDown aria-hidden data-ns-glide="" className={cn("size-3.5 shrink-0 [transition:rotate_var(--ns-time-snap)_var(--ns-ease-move)]", open && "rotate-180")} />;
  const button =
    variant === "toggle" ? (
      <button
        type="button"
        id={triggerId}
        data-ns-disclosure=""
        data-ns-press=""
        aria-expanded={open}
        aria-controls={id}
        disabled={disabled}
        onClick={toggle}
        className="-ms-2 inline-flex min-h-[var(--ns-control-sm,30px)] cursor-pointer items-center gap-1.5 self-start rounded-[var(--ns-radius)] px-2 text-[length:var(--ns-text-small)] font-[number:var(--ns-weight-medium)] text-[var(--ns-ink-2)] outline-hidden hover:bg-[var(--ns-hover)] hover:text-[var(--ns-ink)] focus-visible:outline-2 focus-visible:outline-[var(--ns-signal)] disabled:cursor-default disabled:text-[var(--ns-ink-3)] pointer-coarse:min-h-11"
      >
        {words}
        {turn}
      </button>
    ) : variant === "header" ? (
      <button
        type="button"
        id={triggerId}
        data-ns-disclosure=""
        aria-expanded={open}
        aria-controls={id}
        disabled={disabled}
        onClick={toggle}
        className="group/acc flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-start outline-hidden [transition:background-color_var(--ns-time-color)] hover:bg-[color-mix(in_oklab,var(--ns-ink)_3%,transparent)] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ns-signal)] disabled:cursor-default pointer-coarse:min-h-11"
      >
        {lead}
        <span className="min-w-0 flex-1">
          <span className="block truncate text-[length:var(--ns-text-body)] leading-5 font-[number:var(--ns-weight-medium)] text-[var(--ns-ink)]">{words}</span>
          {line !== undefined && <span className="block truncate text-[length:var(--ns-text-meta)] leading-4 text-[var(--ns-ink-3)]">{line}</span>}
        </span>
        <span className="text-[var(--ns-ink-3)] group-hover/acc:text-[var(--ns-ink)]">{turn}</span>
      </button>
    ) : (
    <button
      type="button"
      id={triggerId}
      data-ns-disclosure=""
      data-ns-press=""
      aria-expanded={open}
      aria-controls={id}
      disabled={disabled}
      onClick={toggle}
      className={cn(
        "flex w-full cursor-pointer items-center gap-2 rounded-[var(--ns-radius)] px-1 text-start [--ns-press-scale:0.99] font-[number:var(--ns-weight-medium)] text-[var(--ns-ink)] outline-hidden hover:bg-[var(--ns-hover)] focus-visible:outline-2 focus-visible:outline-[var(--ns-signal)] disabled:cursor-default disabled:text-[var(--ns-ink-3)] disabled:hover:bg-transparent",
        size === "lg" ? "min-h-14 py-3 text-[length:var(--ns-text-sub)]" : "min-h-[var(--ns-control)] text-[length:var(--ns-text-body)]",
      )}
    >
      <ChevronRight aria-hidden data-ns-glide="" className={cn("size-3.5 shrink-0 text-[var(--ns-ink-3)] [transition:rotate_var(--ns-time-menu)_var(--ns-ease-move)] rtl:-scale-x-100", open && "rotate-90 rtl:scale-x-100")} />
      <span className="min-w-0 flex-1 [overflow-wrap:anywhere]">{words}</span>
      {meta !== undefined && <span className="shrink-0 text-[length:var(--ns-text-meta)] font-[number:var(--ns-weight-regular)] text-[var(--ns-ink-3)] tabular-nums">{meta}</span>}
    </button>
    );
  const Heading = headingLevel ? (`h${headingLevel}` as const) : null;
  return (
    <div data-slot="disclosure" data-open={open || undefined} className={cn("flex min-w-0 flex-col", className)}>
      {Heading ? <Heading className="m-0 text-[length:inherit] font-[number:inherit]">{button}</Heading> : button}
      <Reveal open={open}>
        <div id={id} role="region" aria-labelledby={triggerId} className={cn("text-[length:var(--ns-text-body)] text-[var(--ns-ink-2)]", variant === "row" ? "ps-[calc(0.875rem+0.75rem)]" : variant === "header" ? "ps-[52px] pe-4 pb-2" : "", size === "lg" ? "pb-5 leading-[var(--ns-leading-prose)]" : "pt-1")}>
          {children}
        </div>
      </Reveal>
    </div>
  );
}

type DisclosureGroupProps = {
  /** More than one panel open at once (default: opening one closes the others). */
  multiple?: boolean | undefined;
  /** Controlled: the open panels' values. */
  value?: string[] | undefined;
  /** Uncontrolled: the panels open at first. */
  defaultValue?: string[] | undefined;
  /** Called with the open panels' values on every press. */
  onValueChange?: ((value: string[]) => void) | undefined;
  /** What the group is, for screen readers ("Questions"). */
  label?: string | undefined;
  children: React.ReactNode;
  className?: string | undefined;
};

/* the triggers that belong to this group, not to one nested in a panel */
function ownTriggers(root: HTMLElement) {
  return [...root.querySelectorAll<HTMLButtonElement>("button[data-ns-disclosure]:not(:disabled)")].filter((b) => b.closest("[data-slot=disclosure-group]") === root);
}

function DisclosureGroup({ multiple = false, value, defaultValue, onValueChange, label, children, className }: DisclosureGroupProps) {
  const [open, setOpen] = useControllable<string[]>({ value, defaultValue: defaultValue ?? [], onChange: onValueChange });
  const ctx = React.useMemo<GroupCtx>(
    () => ({
      isOpen: (v) => open.includes(v),
      toggle: (v) => setOpen((o) => (o.includes(v) ? o.filter((x) => x !== v) : multiple ? [...o, v] : [v])),
    }),
    [open, setOpen, multiple],
  );
  const onKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
    const t = e.target as HTMLElement;
    if (!t.matches("button[data-ns-disclosure]")) return;
    const all = ownTriggers(e.currentTarget);
    const i = all.indexOf(t as HTMLButtonElement);
    if (i < 0) return;
    const to = e.key === "ArrowDown" ? (i + 1) % all.length : e.key === "ArrowUp" ? (i - 1 + all.length) % all.length : e.key === "Home" ? 0 : e.key === "End" ? all.length - 1 : -1;
    if (to < 0) return;
    e.preventDefault();
    all[to]!.focus();
  };
  return (
    <Group.Provider value={ctx}>
      <div data-slot="disclosure-group" role={label ? "group" : undefined} aria-label={label} onKeyDown={onKeyDown} className={cn("flex min-w-0 flex-col divide-y divide-[var(--ns-line)] [&>*]:py-1", className)}>
        {children}
      </div>
    </Group.Provider>
  );
}

/**
 * The quiet toggle a reply's rows use (its thinking, the sources it read, the rest of a list): a small ink-3 line and a
 * chevron, closed by default, the panel under it. `lead` goes before the words (a spinner while busy).
 */
function DisclosureToggle({ open, controls, lead, onToggle, children }: { open: boolean; controls: string; lead?: React.ReactNode; onToggle: () => void; children: React.ReactNode }) {
  return (
    <button
      type="button"
      {...disclosureTrigger(open, controls, onToggle)}
      className="inline-flex cursor-pointer items-center gap-1.5 min-h-6 rounded-[var(--ns-radius-sm)] px-1 -ms-1 text-[length:var(--ns-text-small)] text-[var(--ns-ink-3)] outline-hidden hover:text-[var(--ns-ink-2)] focus-visible:outline-2 focus-visible:outline-[var(--ns-signal)]"
    >
      {lead}
      {children}
      <ChevronDown aria-hidden className={cn("size-3.5 [transition:rotate_var(--ns-time-color)]", open && "rotate-180")} />
    </button>
  );
}

export { Disclosure, DisclosureGroup, DisclosureToggle, StepList, type Step, disclosureScope, disclosureTrigger, useDisclosure, type DisclosureProps, type DisclosureGroupProps };
```

### lib/notchset/controllable.ts

```tsx
// Notchset disclosure 1.2.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";

/**
 * Controlled and uncontrolled, one source of truth: a piece takes `value` with `onValueChange` (controlled) or
 * `defaultValue` (uncontrolled), and reads and sets it through this hook. Controlled, it shows `value` and only asks
 * for a change; uncontrolled, it keeps its own state; it never switches between the two after its first render. On a
 * Base UI root it hands Base UI the controlled value. Controlled, two identical sets in one event can each call
 * onChange (the second is compared with what is shown, not with what was asked): harmless for open and close; a host
 * whose onChange has side effects makes it idempotent.
 * @example
 * const [value, setValue] = useControllable({ value: props.value, defaultValue: props.defaultValue ?? 0, onChange: props.onValueChange });
 * const [open, setOpen] = useControllableOpen(props);
 */
export function useControllable<T>({ value, defaultValue, onChange }: { value?: T | undefined; defaultValue: T; onChange?: ((next: T) => void) | undefined }): [T, (next: T | ((prev: T) => T)) => void] {
  const controlled = value !== undefined;
  const [own, setOwn] = React.useState(defaultValue);
  const current = controlled ? value : own;
  /* `asked` is what this event asked for so far, cleared by each render, so a refused request can be made again; written in an insertion effect so a layout effect reads this render's value. */
  const latest = React.useRef<{ current: T; controlled: boolean; onChange: typeof onChange; asked?: { v: T } | undefined }>({ current, controlled, onChange });
  React.useInsertionEffect(() => {
    latest.current = { current, controlled, onChange };
  });
  const set = React.useCallback((next: T | ((prev: T) => T)) => {
    const l = latest.current;
    const base = l.asked ? l.asked.v : l.current;
    const v = typeof next === "function" ? (next as (prev: T) => T)(base) : next;
    if (Object.is(v, base) && (!l.asked || Object.is(v, l.current))) return;
    l.asked = { v };
    if (!l.controlled) setOwn(v);
    l.onChange?.(v);
  }, []);
  return [current, set];
}

/** The same for a piece that opens: `open` with `onOpenChange`, or `defaultOpen`. */
export function useControllableOpen({ open, defaultOpen = false, onOpenChange }: { open?: boolean | undefined; defaultOpen?: boolean | undefined; onOpenChange?: ((open: boolean) => void) | undefined }) {
  return useControllable({ value: open, defaultValue: defaultOpen, onChange: onOpenChange });
}
```

### components/ui/notchset/disclosure-parts.tsx

```tsx
// Notchset disclosure 1.2.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { useControllableOpen } from "@/lib/notchset/controllable";

/* The disclosure contract without its look (disclosure.tsx draws the rows): for a piece with its own trigger, keeping
   its own open state (the attributes) or this one (useDisclosure). */

/**
 * The trigger attributes for one row of a list whose open rows the list keeps (a hook can't run per row).
 * @example
 * <button type="button" {...disclosureTrigger(open === row.id, `${id}-${row.id}`, () => setOpen(open === row.id ? null : row.id))}>
 */
function disclosureTrigger(open: boolean, controls: string, onToggle: () => void) {
  return { "aria-expanded": open, "aria-controls": controls, onClick: onToggle };
}

/** A valid panel id: a key with a space would split aria-controls, so non-word characters become _. */
function partId(uid: string, key: string) {
  return `${uid}-${key.replace(/[^\w-]/g, "_")}`;
}

/** Spread on the element holding a disclosure: Escape there folds an open one, focus back on its trigger. */
function disclosureScope(open: boolean, controls: string, onFold: () => void) {
  return {
    onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => {
      if (e.key !== "Escape" || !open) return;
      e.stopPropagation();
      onFold();
      e.currentTarget.querySelector<HTMLElement>(`[aria-controls="${CSS.escape(controls)}"]`)?.focus();
    },
  };
}

type DisclosureScopeProps = React.HTMLAttributes<HTMLDivElement> & {
  /** whether the disclosure inside is open */
  open: boolean;
  /** the id of the panel its trigger controls */
  controls: string;
  /** folds it (the host's own state) */
  onFold: () => void;
};

/** disclosureScope as the element itself: `<DisclosureScope open={open} controls={bodyId} onFold={fold}>…` */
const DisclosureScope = React.forwardRef<HTMLDivElement, DisclosureScopeProps>(function DisclosureScope({ open, controls, onFold, ...rest }, ref) {
  return <div data-slot="disclosure-scope" ref={ref} {...rest} {...disclosureScope(open, controls, onFold)} />;
});

type OpenProps = {
  /** Controlled: open or closed. */
  open?: boolean | undefined;
  /** Uncontrolled: how it starts. */
  defaultOpen?: boolean | undefined;
  /** Called with the new state on every press. */
  onOpenChange?: ((open: boolean) => void) | undefined;
};

/**
 * The disclosure contract for a trigger with its own look.
 * @example
 * const d = useDisclosure({ defaultOpen: false });
 * <button {...d.trigger}>Show all</button>
 * {d.open && <ul {...d.panel}>…</ul>}
 */
function useDisclosure({ open: openProp, defaultOpen, onOpenChange }: OpenProps = {}) {
  const [open, setOpen] = useControllableOpen({ open: openProp, defaultOpen, onOpenChange });
  const id = React.useId();
  const toggle = React.useCallback(() => setOpen((o) => !o), [setOpen]);
  return {
    open,
    setOpen,
    toggle,
    /** Spread on the button that opens and closes it. */
    trigger: disclosureTrigger(open, id, toggle),
    /** Spread on the element it shows (it must stay mounted, or be the one the trigger points at once open). */
    panel: { id },
    /** Spread on the element holding the trigger and the panel: Escape there folds it, focus back on the trigger. */
    scope: disclosureScope(open, id, () => setOpen(false)),
  };
}

export { DisclosureScope, disclosureScope, disclosureTrigger, partId, useDisclosure, type DisclosureScopeProps, type OpenProps };
```

### lib/notchset/icons.ts

```tsx
// Notchset disclosure 1.2.0 · https://notchset.dev/changelog
/** Every piece imports its icons from here: swap the icon set in this one file. */
export * from "lucide-react";
```

### lib/notchset/motion.ts

```tsx
// Notchset disclosure 1.2.0 · https://notchset.dev/changelog
"use client";
/*
 * Less motion, the one switch every piece reads, and a motion role's timing for a Web Animation. Split from
 * physics.ts so a piece that needs only these does not carry the springs.
 */
import * as React from "react";

/**
 * Less motion where `el` sits: the device's setting, then a data-motion="reduced" on `el` or any ancestor, falling
 * back to <html>'s when there is no element. The one copy: every piece reads this.
 */
const REDUCED = '[data-motion="reduced"],[data-motion="off"]';
export function lessMotion(el?: Element | null): boolean {
  if (typeof document === "undefined") return true;
  if (typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches) return true;
  return !!(el?.closest?.(REDUCED) ?? document.documentElement.matches(REDUCED));
}

/** Less motion, kept current as the setting changes; true on a server, so a piece starts in its still. */
export function useLessMotion(): boolean {
  return React.useSyncExternalStore(
    (f) => {
      if (typeof matchMedia === "undefined") return () => {};
      const q = matchMedia("(prefers-reduced-motion: reduce)");
      q.addEventListener("change", f);
      const mo = typeof MutationObserver === "undefined" ? null : new MutationObserver(f);
      mo?.observe(document.documentElement, { attributes: true, attributeFilter: ["data-motion"] });
      return () => {
        q.removeEventListener("change", f);
        mo?.disconnect();
      };
    },
    () => lessMotion(),
    () => true,
  );
}

/** A motion role's duration and curve (0 under less motion: the result at once), read from the foundation where `el` sits, for a Web Animation that glides
    something CSS can't transition (a width to `auto`, a node on its way out): `roleTiming(el, "--ns-time-menu")`. */
export function roleTiming(el: Element, time: string, ease = "--ns-ease"): KeyframeAnimationOptions {
  if (lessMotion(el)) return { duration: 0, easing: "linear" };
  const cs = getComputedStyle(el);
  const t = cs.getPropertyValue(time).trim();
  const ms = t.endsWith("ms") ? parseFloat(t) : parseFloat(t) * 1000;
  return { duration: Number.isFinite(ms) ? ms : 0, easing: cs.getPropertyValue(ease).trim() || "linear" };
}

/** The foundation's curves as literal strings, for a Web Animation (`element.animate`, `KeyframeEffect`,
    `updateTiming`): those take a literal easing and throw on a CSS var. Copied from foundation.css's `--ns-ease-*`;
    CSS transitions and keyframes keep the vars. */
export const EASE = {
  enter: "cubic-bezier(0.22, 1, 0.36, 1)",
  move: "cubic-bezier(.5, 0, .2, 1)",
  exit: "cubic-bezier(.6, 0, .9, .5)",
  panel: "cubic-bezier(0.32, 0.72, 0, 1)",
  press: "cubic-bezier(0.2, 0, 0, 1)",
  spring: "cubic-bezier(0.16, 1, 0.3, 1)",
  arrive: "cubic-bezier(.3, 1.22, .5, 1)",
  breathe: "cubic-bezier(.45, 0, .55, 1)",
} as const;
```

The foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://notchset.dev/r/notchset-foundation.json.
