<!-- generated by scripts/gen-docs.mjs from docs/system/grow.md. Edit the source and rerun. -->
# Grow

## Description
A button that grows into the one small form it opens, such as a link to add or a name to save, and shrinks back when you are done.

`import { Grow } from "@/components/cobalt/ui/grow"`, source `registry/cobalt/ui/grow.tsx`, status `ready-with-gaps`.
Foundation: `hand-rolled on the motion/react animate function and useReducedMotion`. Traps checked: `trap/motion-origin`, `trap/motion-exit-slower`, `trap/motion-layout-property` (n/a: the box animates its real width and height, because what sits below must move with it and a scale would stretch what is inside), `trap/motion-overshoot`, `trap/motion-blocks-input`, `trap/motion-restart`, `trap/motion-frequent`, `trap/reduced-motion-ignored`, `trap/overlay-focus-return`, `trap/escape-nested`, `trap/overlay-no-max-height`, `trap/overlay-destructive`, `trap/weight-shift`, `trap/demo-on-timers`.

### Foundation
| Given by the foundation | Added by the team |
|---|---|
| motion `animate` on the box's own `width`, `height` and `borderRadius`, from where each is to where it ends; `springs.layout` and `springs.settle`; `useReducedMotion` | One box that is both the closed button and the open panel, with the trigger kept inside it as the panel's title row, so the label never moves (`registry/cobalt/ui/grow.tsx:240-262`); the body laid out once at its final width and clipped while the box grows to it, so nothing inside reflows or scales (`registry/cobalt/ui/grow.tsx:156-157`); it opens with its width and corner on the settle spring and its height on the layout spring, so the body is revealed row by row, and closes on the shorter settle spring, so a close never keeps the person waiting (`registry/cobalt/ui/grow.tsx:161-182`); the body's opacity on the same spring as the growth while it opens, so a field or a button the box has half revealed is half there and never shows as a cut-off sliver, and a quick fade out first when it closes (`registry/cobalt/ui/grow.tsx:114-131`); padding that never animates: 10px on the title row and the body, set once (`registry/cobalt/ui/grow.tsx:268`, `registry/cobalt/ui/grow.tsx:283`); the corner going from a control's 10px to 10 + 10 = 20px, concentric around the 10px controls inside (D38, `registry/cobalt/ui/grow.tsx:17-21`); a body that changes height while open, such as an error line, grows the box on the layout spring (`registry/cobalt/ui/grow.tsx:195-205`); the two placements, in place (the default) and `floating`; focus into the body's first field on open and back to the trigger on Escape or `close`; Escape stopped on the panel; an outside press that closes a floating panel; the focus outline drawn on the box, since the box clips; `select-none` on the trigger, so a double press selects no text |

## Examples
A button that grows into the form it opens above a list, and a toolbar button whose form floats over a table. A row of a list that opens to its details is Collapsible's job: Grow used to have a `row` variant for it, which drew the same thing a second way, so it is gone and its examples moved to Collapsible.

Real uses, 0 call sites (`rg -n "<Grow\b" app registry --glob '!registry/cobalt/ui/*'`): the showcase chrome renders no Grow of its own yet, and the examples folder does not count.

Uses inside the registry, which other components build on: none. Grow composes nothing and nothing composes it yet.

### Example files
| File | Covers | Caption |
|---|---|---|
| `docs/system/examples/grow/default.tsx` | default | Add a source grows into the form it opens, and the sources below it make room |
| Not applicable: the default example grows in place, which is the default | floating=false | The panel takes its row's width and moves what is below it down by its growth |
| `docs/system/examples/grow/floating.tsx` | floating=true | Save view floats over the table, so the rows stay where they are |
| Not applicable: every example is closed at rest | state:closed | The control with its label, the hover tint under the pointer |
| Not applicable: open is reached by pressing the trigger on any example | state:open | The panel at its size, the label where it was, focus in the first field |
| Not applicable: closing is the 300ms path back after Escape, Cancel, Save or an outside press on any example | state:closing | The box shrinking back to the control, the body faded out first |
| Not applicable: the trigger has no press look beyond the press tint | state:pressed | The control darkened in place |
| `docs/system/examples/grow/default.tsx` | composition:ItemGroup | The button above a list of sources, which make room while it grows |

Example: Add a source grows into the form it opens, and the sources below it make room (`docs/system/examples/grow/default.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import { Grow } from "@/components/cobalt/ui/grow";
import { Input } from "@/components/cobalt/ui/input";
import { Item, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/cobalt/ui/item";
import { StateButton } from "@/components/cobalt/ui/state-button";
import { useAction } from "@/lib/cobalt/use-action";

// Stands in for your API call. It answers after 900ms, and fails while the browser is offline or the
// address has ?network=offline.
const request = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

const hostOf = (address: string) => {
  try {
    return new URL(address.includes("://") ? address : `https://${address}`).hostname.replace(/^www\./, "");
  } catch {
    return address;
  }
};

function SourceForm({ onAdded, close }: { onAdded: (address: string) => void; close: () => void }) {
  const [address, setAddress] = useState("");
  const add = useAction(async (value: string) => {
    await request();
    return value;
  });
  return (
    <form
      className="flex flex-col gap-2.5"
      onSubmit={(event) => {
        event.preventDefault();
        const value = address.trim();
        if (value === "") return;
        void add.run(value).then((added) => {
          if (added === undefined) return;
          onAdded(added);
          close();
        });
      }}
    >
      <Input
        aria-label="Source address"
        placeholder="Paste a link to a paper or dataset"
        value={address}
        onChange={(event) => setAddress(event.target.value)}
      />
      {add.error !== null && (
        <p role="alert" className="text-sm text-destructive">
          Not added. Check your connection and try again.
        </p>
      )}
      <div className="flex justify-end gap-2">
        <Button type="button" variant="ghost" size="sm" onClick={close}>
          Cancel
        </Button>
        <StateButton type="submit" size="sm" status={add.status} pendingLabel="Adding" failureLabel="Not added">
          Add source
        </StateButton>
      </div>
    </form>
  );
}

export default function Example() {
  const [sources, setSources] = useState([
    { title: "Scaling laws for retrieval", host: "arxiv.org" },
    { title: "Open web crawl, March sample", host: "commoncrawl.org" },
    { title: "Benchmark leaderboard", host: "paperswithcode.com" },
  ]);
  const [initial] = useState(sources.length);
  return (
    <div className="flex w-full max-w-sm flex-col gap-2">
      <Grow label="Add a source">
        {({ close }) => (
          <SourceForm
            onAdded={(address) => setSources((was) => [...was, { title: address, host: hostOf(address) }])}
            close={close}
          />
        )}
      </Grow>
      <ItemGroup render={<ul aria-label="Sources" aria-live="polite" />}>
        {sources.map((source, index) => (
          // A source added while you watch arrives at the end of the list, under the closing panel.
          <Item key={index} render={<li />} className={index >= initial ? "animate-arrive" : undefined}>
            <ItemContent>
              <ItemTitle>{source.title}</ItemTitle>
              <ItemDescription>{source.host}</ItemDescription>
            </ItemContent>
          </Item>
        ))}
      </ItemGroup>
    </div>
  );
}
```

Example: The button above a list of sources, which make room while it grows (`docs/system/examples/grow/default.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import { Grow } from "@/components/cobalt/ui/grow";
import { Input } from "@/components/cobalt/ui/input";
import { Item, ItemContent, ItemDescription, ItemGroup, ItemTitle } from "@/components/cobalt/ui/item";
import { StateButton } from "@/components/cobalt/ui/state-button";
import { useAction } from "@/lib/cobalt/use-action";

// Stands in for your API call. It answers after 900ms, and fails while the browser is offline or the
// address has ?network=offline.
const request = () =>
  new Promise<void>((resolve, reject) =>
    setTimeout(() => {
      const offline = !navigator.onLine || new URLSearchParams(location.search).get("network") === "offline";
      if (offline) reject(new Error("offline"));
      else resolve();
    }, 900),
  );

const hostOf = (address: string) => {
  try {
    return new URL(address.includes("://") ? address : `https://${address}`).hostname.replace(/^www\./, "");
  } catch {
    return address;
  }
};

function SourceForm({ onAdded, close }: { onAdded: (address: string) => void; close: () => void }) {
  const [address, setAddress] = useState("");
  const add = useAction(async (value: string) => {
    await request();
    return value;
  });
  return (
    <form
      className="flex flex-col gap-2.5"
      onSubmit={(event) => {
        event.preventDefault();
        const value = address.trim();
        if (value === "") return;
        void add.run(value).then((added) => {
          if (added === undefined) return;
          onAdded(added);
          close();
        });
      }}
    >
      <Input
        aria-label="Source address"
        placeholder="Paste a link to a paper or dataset"
        value={address}
        onChange={(event) => setAddress(event.target.value)}
      />
      {add.error !== null && (
        <p role="alert" className="text-sm text-destructive">
          Not added. Check your connection and try again.
        </p>
      )}
      <div className="flex justify-end gap-2">
        <Button type="button" variant="ghost" size="sm" onClick={close}>
          Cancel
        </Button>
        <StateButton type="submit" size="sm" status={add.status} pendingLabel="Adding" failureLabel="Not added">
          Add source
        </StateButton>
      </div>
    </form>
  );
}

export default function Example() {
  const [sources, setSources] = useState([
    { title: "Scaling laws for retrieval", host: "arxiv.org" },
    { title: "Open web crawl, March sample", host: "commoncrawl.org" },
    { title: "Benchmark leaderboard", host: "paperswithcode.com" },
  ]);
  const [initial] = useState(sources.length);
  return (
    <div className="flex w-full max-w-sm flex-col gap-2">
      <Grow label="Add a source">
        {({ close }) => (
          <SourceForm
            onAdded={(address) => setSources((was) => [...was, { title: address, host: hostOf(address) }])}
            close={close}
          />
        )}
      </Grow>
      <ItemGroup render={<ul aria-label="Sources" aria-live="polite" />}>
        {sources.map((source, index) => (
          // A source added while you watch arrives at the end of the list, under the closing panel.
          <Item key={index} render={<li />} className={index >= initial ? "animate-arrive" : undefined}>
            <ItemContent>
              <ItemTitle>{source.title}</ItemTitle>
              <ItemDescription>{source.host}</ItemDescription>
            </ItemContent>
          </Item>
        ))}
      </ItemGroup>
    </div>
  );
}
```

## Variants

### floating
- `false`: the panel grows where the control stands, to its row's full width, on `bg-muted` with no shadow, and what is below moves down by exactly the panel's growth, on the same spring (measured at most 0.1px between the growth and the movement below in any frame, `.design-system/evidence/grow/frames.json`). For a control beside a list, in a card or in a form. The default; `default.tsx`.
- `true`: the panel lifts out over the page at `z-20` on `bg-popover` with `shadow-floating`, its top-left corner on the control's, so the label stays where it was and nothing on the page moves; the control's place in the page is held while it is out. Its width is `width`, 320px by default, narrowed to the room left to the viewport's edge less 16px. For a toolbar control over dense content, such as a table. `floating.tsx`.

Example: Save view floats over the table, so the rows stay where they are (`docs/system/examples/grow/floating.tsx`)

```tsx
import { useState } from "react";

import { Button } from "@/components/cobalt/ui/button";
import { Grow } from "@/components/cobalt/ui/grow";
import { Input } from "@/components/cobalt/ui/input";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/cobalt/ui/table";

const failed = [
  ["orders_daily", "Timeout"],
  ["invoices_weekly", "Schema changed"],
  ["sessions_hourly", "Timeout"],
  ["refunds_daily", "Quota reached"],
  ["accounts_sync", "Credentials expired"],
];

export default function Example() {
  const [views, setViews] = useState<string[]>([]);
  const [name, setName] = useState("");
  return (
    <div className="flex w-full max-w-sm flex-col gap-3">
      <div className="flex items-center gap-3">
        <Grow floating width={288} label="Save view" onOpenChange={(open) => open && setName("")}>
          {({ close }) => (
            <form
              className="flex flex-col gap-2.5"
              onSubmit={(event) => {
                event.preventDefault();
                if (name.trim() === "") return;
                setViews((was) => [...was, name.trim()]);
                close();
              }}
            >
              <Input
                aria-label="View name"
                placeholder="Failed this week"
                value={name}
                onChange={(event) => setName(event.target.value)}
              />
              <div className="flex justify-end gap-2">
                <Button type="button" variant="ghost" size="sm" onClick={close}>
                  Cancel
                </Button>
                <Button type="submit" size="sm">
                  Save
                </Button>
              </div>
            </form>
          )}
        </Grow>
        <span aria-live="polite" className="min-w-0 truncate text-sm text-muted-foreground">
          {views.length === 0 ? "Status is Failed" : `Saved as ${views[views.length - 1]}`}
        </span>
      </div>
      <Table>
        <TableHeader>
          <TableRow>
            <TableHead>Job</TableHead>
            <TableHead align="end">Reason</TableHead>
          </TableRow>
        </TableHeader>
        <TableBody>
          {failed.map(([job, reason]) => (
            <TableRow key={job}>
              <TableHead scope="row">{job}</TableHead>
              <TableCell align="end" className="text-muted-foreground">
                {reason}
              </TableCell>
            </TableRow>
          ))}
        </TableBody>
      </Table>
    </div>
  );
}
```


## States
| State | Trigger | What the user can do | Shown by, besides color | Checked by |
|---|---|---|---|---|
| closed | render | press the control, focus it | one `<button>` with `aria-expanded="false"`, no body in the tree, a 10px corner | test |
| pressed | pointer or key down on the control | release to open | the press tint in place; nothing scales (D36) | by hand |
| open | a press, Enter or Space on the control | fill the field, press the body's actions, Escape, press the title row to close, press outside a floating panel | the panel at its size with a 20px corner, the label where it was, `aria-expanded="true"`, focus in the first field | by hand |
| closing | Escape inside the panel, `close()` from the body, a press on the title row, an outside press on a floating panel | press the control again, which turns the animation around from where it is | the box shrinking to the control's size, the body fading out and clipped, focus on the control | by hand |

### State precedence
- Open and pressed: open wins. A press on the title row of an open panel closes it, and the row shows no hover tint while the panel is out.
- Closing and open: open wins. A press during the 300ms path back opens again from the size the box has at that moment (measured continuous: the largest change between two frames was 35px of width, the spring's own speed, `.design-system/evidence/grow/frames.json`, `interrupt`).
- Open and a body that changes height: both show. The panel grows or shrinks to its body's new height on the same spring, so an error line under the field never jumps.

### Motion
| Trigger | Kind | Preset | Properties | Reduced motion |
|---|---|---|---|---|
| open | input | `springs.layout`, a 0.45s spring with no bounce, mirrored as `--t-layout`; measured the largest step between two 16ms frames at 12 percent of the growth and the box at rest at 368 to 400ms (Playwright, fake clock, 2026-10-17) | the box's real `width` (to its row's width, or `width` floating), `height` (to its body's height) and `borderRadius` (10px to 20px), each from its current value; the body's opacity on the same spring, so it equals the share of the box grown; the fill and the floating shadow on `--t-layout`. No transform on the box: the label and the body never scale or move | width, height and corner are set to their end at once; the body still fades, since opacity moves nothing (measured: full size on the first frame, `.design-system/evidence/grow/frames.json`, `reduced`) |
| close | input | `springs.settle`, a 0.3s spring with no bounce, mirrored as `--t-settle`; measured at rest at 256ms | the same three back to the control's size and 10px corner; the body fades out on `--t-fade` first, so the box shrinks with nothing in it being cut, and is removed when the box is back | the same, at once |
| body height change while open | announce | `springs.layout` | the box's `height` to the body's new height | at once |

## Props

<!-- Props generated from registry/cobalt/ui/grow.tsx with TypeScript by scripts/props-table.mjs -->
| Prop | Type | Default | Purpose |
|---|---|---|---|
| `children` | `(controls: { close: () => void; }) => ReactNode` |  | The panel's body, under the title row. |
| `label` | `ReactNode` |  | The trigger's content. |
| `className?` | `string` |  |  |
| `floating?` | `boolean` | `false` | Lay the panel over the page instead of growing in the page's flow. |
| `onOpenChange?` | `(open: boolean) => void` |  |  |
| `triggerClassName?` | `string` |  |  |
| `width?` | `number` | `320` | The floating panel's width in pixels, narrowed to the room left in the viewport. |

`label` is the control's content. It stays as the panel's title row, and it names the panel. `children` is a function that receives `close`, so the body's own action can run the path back; it is called only while the panel is open or closing. `floating` lays the panel over the page. `width` is the floating panel's width in pixels. `onOpenChange` reports every open and close. `className` is for placement of the root. `triggerClassName` reaches the trigger button.

## Usage

### When to use
- A control asks for one small answer, a line of text or a name, and you should keep your eyes on the control you pressed while you type: the panel grows out of it.
- A toolbar control sits over dense content that must not move, such as a table: `floating`.

### When not to use
- The content is a list of commands. Use DropdownMenu instead, which has menu roles and keyboard selection.
- The panel would hold more than 1 field. Use Sheet instead.
- The answer needs a decision with a title, a body and two actions. Use Dialog or AlertDialog instead.
- The panel is informational and anchored to a control without becoming it. Use Popover instead.
- A row of a list, a line of a card or a question opens to its details or its answer. Use Collapsible instead, which owns that job; Grow is for a button that becomes a form.
- The content changes in place without a trigger. Use Swap, Crossfade or TextSwap instead.

### Rules
- `rule/grow-one-field`: When the panel would hold more than 1 field or more than 2 actions, use Sheet instead of Grow, because the panel is one question under one title row, and a stack of fields under a title that is a button reads as a form with no heading of its own. Evidence: principle heuristic: aesthetic and minimalist design, one question gets one panel; measured 4 of 4 example bodies and 3 of 3 stress bodies holding at most 1 field and 2 actions. Check: review of every Grow's children for one field and up to 2 actions.
  - Don't: `<Grow label="New event">{({ close }) => <form><Input aria-label="Title" /><Input aria-label="Place" /><Input aria-label="Date" /><Button onClick={close}>Create</Button></form>}</Grow>`
  - Do: `<Sheet><SheetTrigger>New event</SheetTrigger><SheetContent>...</SheetContent></Sheet>`
- `rule/grow-in-place-beside-neighbours`: When the control sits in a list, a card or a form, leave `floating` off instead of laying the panel over its neighbours, because in place the panel moves only what is below it, by exactly its own growth on the same spring, and a floating panel covers the rows you may be reading. Evidence: measured at most 0.1px between the panel's growth and the movement of the row below in any frame of 5 in-place Grows at 390 and 1440, .design-system/evidence/grow/frames.json; principle heuristic: visibility of system status, the row you are editing stays in view. Check: review of every Grow inside a Card, a row or a list.
  - Don't: `<CardContent><Grow floating label="Rename">{...}</Grow></CardContent>`
  - Do: `<CardContent><Grow label="Rename">{...}</Grow></CardContent>`
- `rule/grow-floating-at-row-start`: When a Grow floats, place its control at the start of its row instead of at the end, because the panel's top-left corner sits on the control's so the label stays where it was, and a control at the end of a row sends the panel past the row's edge. Evidence: measured the floating panel 288px wide from a 84px control, its left edge on the control's in every frame, .design-system/evidence/grow/frames.json; principle heuristic: consistency and standards, the label you pressed does not move. Check: review of every floating Grow at 390.
  - Don't: `<div className="flex justify-between"><h2>Failed runs</h2><Grow floating label="Save view">{...}</Grow></div>`
  - Do: `<div className="flex items-center gap-3"><Grow floating label="Save view">{...}</Grow><span>Status is Failed</span></div>`
- `rule/grow-close-from-inside`: When the body's action finishes, call the `close` the children receive instead of unmounting the Grow or hiding its parent, because `close` runs the box back on the settle spring and returns focus to the control, while an unmount drops focus to the page (`trap/overlay-focus-return`). Evidence: measured focus on the trigger after Escape in all 48 recordings, .design-system/evidence/grow/frames.json; principle wcag: 2.4.3 Focus order, focus returns to where the person was. Check: review of every Grow's children for a `close` call on its action.
  - Don't: `{editing && <Grow label="Rename">{() => <Button onClick={() => setEditing(false)}>Save</Button>}</Grow>}`
  - Do: `<Grow label="Rename">{({ close }) => <Button onClick={() => { save(); close(); }}>Save</Button>}</Grow>`
- `rule/grow-field-named`: When the body holds a field, name it with `aria-label` or a Label of its own, such as "Source address", instead of leaving the title row to name it, because the title row is the trigger button and names the panel's group, not the field, and a placeholder is not a name. Evidence: principle wcag: 1.3.1 Info and relationships, a placeholder is not a name; principle wcag: 4.1.2 Name, role, value. Check: lint rule/input-has-a-label on the field (scripts/check-system.mjs); review.
  - Don't: `<Grow label="Add a source">{() => <Input placeholder="Paste a link" />}</Grow>`
  - Do: `<Grow label="Add a source">{() => <Input aria-label="Source address" placeholder="Paste a link" />}</Grow>`

### Content
- Follows `rule/writing-heading-sentence-case`.
- Follows `rule/writing-button-verb`.
- `rule/grow-label-names-the-answer`: When naming a Grow, write `label` as the verb and its object, such as "Add a source" or "Save view", in sentence case and under 24 characters, because the one label is the control's text, the panel's title and the name of its group at once. Evidence: principle wcag: 4.1.2 Name, role, value, the panel's name says what it asks for; principle heuristic: match between system and the real world, the label names the outcome. Check: lint copy/template on the button slot (scripts/copy-check.mjs); review.
  - Don't: `<Grow label="Source">...</Grow>`
  - Do: `<Grow label="Add a source">...</Grow>`

### Anti-slop
- `rule/grow-not-a-menu`: When the content is a list of commands or a choice among more than 4 options, use DropdownMenu or Select instead of a list of buttons inside a Grow, because the panel is one group with no option count, no arrow-key movement and no typeahead, and a screen reader announces only the group with no list to move through. Evidence: principle wcag: 4.1.2 Name, role, value, a list of commands has menu roles; principle platform: a native select or a menu announces its options and takes arrow keys. Check: review.
  - Don't: `<Grow label="Sort">{({ close }) => <>{sorts.map((s) => <Button key={s} variant="ghost" onClick={close}>{s}</Button>)}</>}</Grow>`
  - Do: `<DropdownMenu><DropdownMenuTrigger>Sort</DropdownMenuTrigger><DropdownMenuContent>{sorts.map((s) => <DropdownMenuItem key={s}>{s}</DropdownMenuItem>)}</DropdownMenuContent></DropdownMenu>`
- `rule/grow-real-size-not-scale`: When a box changes size, animate its width and height, as Grow does, instead of putting motion's `layout` or `layoutId` on it, because layout projection draws the change as a scale transform: the old Grow squeezed its body's text and buttons to as little as 26 percent of their height mid-way, drew elliptical corners such as `17.3% / 16.7%`, and moved the label up to 14px (D36, D38). Evidence: measured the old panel's transform scaling it to 0.258 of its height and its body 49.5px wide inside a 288px request, before frames, .design-system/evidence/grow/frames.json; principle platform: a CSS transform scales a box's content and corners with it. Check: lint trap/motion-layout-property (scripts/check-system.mjs); review.
  - Don't: `<motion.div layout style={{ borderRadius: 20 }}>{open && <Form />}</motion.div>`
  - Do: `<Grow label="Add a source">{({ close }) => <Form close={close} />}</Grow>`

### Limits
- `rule/grow-surface-height`: When a floating panel would be taller than the room from its control's top edge to the bottom of the viewport, about 420px for a control in the middle of a 390x844 phone, leave `floating` off or use Sheet instead, because the floating panel hangs from its control's top edge and past that height it leaves the viewport with nothing to scroll it (`trap/overlay-no-max-height`). Evidence: measured the floating panel 124px tall with its top edge on the control's top edge in every frame at 390x844 and 1440x900, .design-system/evidence/grow/frames.json. Check: review of every floating Grow at 390.
  - Don't: `<Grow floating label="Add a note">{() => <Textarea rows={30} aria-label="Note" />}</Grow>`
  - Do: `<Grow label="Add a note">{() => <Textarea rows={4} aria-label="Note" />}</Grow>`

## Accessibility
Rests on a native `<button>` with `aria-expanded` and, while the body is in the tree, `aria-controls`: a disclosure. The body is a `role="group"` named by the button. A floating panel is non-modal: the page stays live and Tab leaves the panel to the page.

### Keyboard
| Key | Where focus is | Effect | Focus after | Checked by |
|---|---|---|---|---|
| Enter or Space | the control | opens the panel | the first field in the body; with no field, the control | by hand |
| Enter or Space | the title row of an open panel | closes it | the title row, which is the control again | by hand |
| Tab and Shift+Tab | inside the panel | moves through the body's controls, then leaves to the page; the panel stays open | the next or previous control | by hand |
| Escape | inside the panel, the title row included | closes the panel and stops there, so a dialog around it stays open (`trap/escape-nested`) | the control (`trap/overlay-focus-return`) | by hand |
| Enter or Space | the body's action, which calls `close` | the action runs and the panel closes | the control | by hand |

### ARIA
| Part | Role | Accessible name from | States and properties | Announced | Checked by |
|---|---|---|---|---|---|
| control and title row | button | its content, `label` | `aria-expanded`; `aria-controls` while the body is in the tree; `data-focus="custom"`, its focus outline drawn on the box | the label, "button", "collapsed" or "expanded" | test |
| body | group | `aria-labelledby` the button | removed from the tree once closed | "group", the label, then the focused control | by hand |

## Tokens
| Part | State | Token |
|---|---|---|
| box | closed | `--secondary`, `--secondary-foreground`, `--r-lg` (10px) |
| box | open in place | `--muted`, `--r-3xl` (20px = 10px control corner + 10px padding) |
| box | open floating | `--popover`, `--popover-foreground`, `shadow-floating`, `--r-3xl` |
| control | all | `--control` as `min-h`, `--hover` under the pointer, `--t-press`, `--curve`, `--ring` drawn on the box |
| box | open | `springs.layout`, mirrored as `--t-layout`; the fill and the shadow on `--t-layout` |
| box | close | `springs.settle`, mirrored as `--t-settle` |
| body | open | `springs.layout` for its opacity |
| body | close | `--t-fade`, `--curve` for its opacity |

## Related
- Collapsible: a row, a line of a card or a question that opens to its details; the job Grow's old row variant did.
- DropdownMenu: a list of commands from a control.
- Sheet: several fields from an edge.
- Dialog: a decision with a title, a body and actions.
- Popover: a surface anchored to a control that stays a control.
- Swap, Crossfade, TextSwap: content that changes in place with no trigger.
