# Menu

Action menus and pickers on the shared popup surface, from a trigger or at the pointer: search, groups, checks, submenus, a rail of sections and a row of swatches.

Live variants: https://design.arcadia.is/components/menu

```tsx
import {
  Menu, MenuTrigger, MenuContent, MenuItem, MenuLinkItem, MenuIconItem,
  MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuGroup, MenuLabel,
  MenuSeparator, MenuEmpty, MenuSearch, MenuSub, MenuSubTrigger, MenuSubContent,
  ContextMenu, ContextMenuTrigger, ContextMenuContent, MenuRail, MenuRailTab,
  MenuHead, MenuOption, MenuSwatchRow,
} from "@arcadia/ui";
```

## When to use

- The actions for one row or object, with the destructive one last
- A set of toggles set together, kept open while a board's filters are set
- A choice among many, or a searchable list, through a `PickerTrigger`

## When not to use

- Content you act on beside its trigger: use `Popover`
- A preview of what a link points to: use `HoverCard`
- A few words naming an icon-only control: use `Tooltip`

## In context

Choose a sort order. The trigger shows the current choice.

```tsx
import { useState } from "react";
import {
  Button, Menu, MenuContent, MenuRadioGroup, MenuRadioItem, MenuTrigger,
} from "@arcadia/ui";

function Actions() {
  const [sort, setSort] = useState("Recently updated");
  return (
    <Menu>
      <MenuTrigger render={<Button variant="secondary" iconEnd="chevron-down">Sort: {sort}</Button>} />
      <MenuContent align="start" aria-label="Sort issues">
        <MenuRadioGroup value={sort} onValueChange={setSort}>
          <MenuRadioItem value="Recently updated">Recently updated</MenuRadioItem>
          <MenuRadioItem value="Newest first">Newest first</MenuRadioItem>
          <MenuRadioItem value="Oldest first">Oldest first</MenuRadioItem>
        </MenuRadioGroup>
      </MenuContent>
    </Menu>
  );
}
```

## Usage

```tsx
import { Button, Menu, MenuContent, MenuItem, MenuTrigger } from "@arcadia/ui";

<Menu>
  <MenuTrigger render={<Button variant="secondary" iconEnd="chevron-down">Options</Button>} />
  <MenuContent>
    <MenuItem icon="copy" shortcut="mod+c" onClick={copy}>Copy</MenuItem>
    <MenuItem icon="trash" tone="danger">Delete</MenuItem>
  </MenuContent>
</Menu>
```

Compose the trigger with `render`: a Button, an IconButton or a PickerTrigger. Every menu uses 28px Body rows with 8px insets. The frame has 4px padding and a radius of 12. Section labels are Caption in the quiet ink. The menu slides 4px toward its trigger as it opens (opened from the keyboard, it is there in one frame, its first row lit whole in that frame), one highlight glides between its rows (a [Glide](/components/glide)), and submenus open on hover with no delay. Escape closes it as the pointer does, with the 110ms fade; from that first frame it takes no press and focus is back on its trigger.

A submenu opens beside its trigger while one side of the menu leaves 180px for it. Where neither side does, as in a phone drawer, it takes the menu's place in the same surface: a Back row named for the row that opened it stands above the submenu's rows, hover no longer opens it, and Left, Escape or Back returns to the menu's rows with focus on that row. Picking a row closes the menu.

One leading glyph keeps a 14px slot and an 8px gap on every row of the menu, across groups. With no glyphs, every label starts at the inset. Do not repeat a glyph down a list. Labels never trail off in dots: the dialog a row opens, or a submenu's chevron, already says more follows.

## Examples

### Filters on a board

The filter button at the bar's end opens a search row, then groups of checkbox rows that keep the menu open: a set of toggles set together.

Open Filter to search or toggle filters.

```tsx
import { useState } from "react";
import {
  Avatar, Chip, Icon, MenuCheckboxItem, PRIORITIES, PriorityMark,
} from "@arcadia/ui";

function BoardFilters({ room }: { room: boolean }) {
  const [on, setOn] = useState<ReadonlySet<string>>(() => new Set(["label:Bug", "priority:urgent", "late"]));
  const [query, setQuery] = useState("");
  const set = (key: string, checked: boolean) => setOn((s) => { const n = new Set(s); if (checked) n.add(key); else n.delete(key); return n; });
  const seen = (word: string) => word.toLowerCase().includes(query.trim().toLowerCase());
  const row = (key: string, word: string, icon: ReactElement | "calendar") => (
    <MenuCheckboxItem key={key} closeOnClick={false} icon={icon} checked={on.has(key)} onCheckedChange={(c) => set(key, c)}>{word}</MenuCheckboxItem>
  );
  const groups = [
    { label: "Holder", rows: HOLDERS.filter(seen).map((h) => row(`holder:${h}`, h, <Avatar name={h} size="text" aria-hidden />)) },
    { label: "Label", rows: BOARD_LABELS.filter((l) => seen(l.name)).map((l) => row(`label:${l.name}`, l.name, <Chip hue={l.hue} dotOnly aria-hidden>{l.name}</Chip>)) },
    { label: "Priority", rows: PRIORITIES.filter((p) => seen(p.label)).map((p) => row(`priority:${p.value}`, p.label, <PriorityMark priority={p.value} aria-hidden />)) },
    { label: "Late", rows: seen("Late") ? [row("late", "Late", "calendar")] : [] },
  ].filter((g) => g.rows.length);
  const chips = [...on].map((key) => {
    const [kind, value = ""] = key.split(":"), drop = () => set(key, false);
    if (kind === "label") return <Chip key={key} hue={BOARD_LABELS.find((l) => l.name === value)!.hue} onRemove={drop}>{value}</Chip>;
    if (kind === "priority") return <Chip key={key} variant="outline" icon={<Icon name={`priority-${value}` as "priority-urgent"} filled={value === "urgent"} />} onRemove={drop} removeLabel={`Remove ${value}`}>{PRIORITIES.find((p) => p.value === value)!.label}</Chip>;
    if (kind === "holder") return <Chip key={key} variant="outline" icon={<Avatar name={value} size="text" />} onRemove={drop} removeLabel={`Remove ${value}`}>{value}</Chip>;
    return <Chip key={key} variant="outline" icon="calendar" onRemove={drop} removeLabel="Remove Late">Late</Chip>;
  });
  const clear = on.size >
```

Each filter in force stands in the bar as a removable outlined chip, a label as itself with its dot and a priority with its mark, and one quiet Clear ends them all. The button carries no count: the chips are the count. Where the bar has no room, the chips move into the menu's head, above its rows. Every row is a `MenuCheckboxItem` that does not close the menu, its glyph decoration beside its word.

### A footer by keys

Tab goes from the search row to each control of the footer and Shift Tab back; the hue picker is one stop with arrows inside, and Tab past the last closes the menu.

```tsx
import { useState } from "react";
import {
  Button, Chip, HuePicker, Menu, MenuCheckboxItem, MenuContent, MenuSearch,
  MenuTrigger,
} from "@arcadia/ui";

function LabelsWithFooter() {
  const [on, setOn] = useState<ReadonlySet<string>>(() => new Set(["Bug"]));
  const [hue, setHue] = useState<LabelHue>("chart-2");
  const set = (name: string, checked: boolean) => setOn((s) => { const n = new Set(s); if (checked) n.add(name); else n.delete(name); return n; });
  return (
    <Menu>
      <MenuTrigger render={<Button variant="secondary" size="sm" icon="tag">Labels</Button>} />
      <MenuContent width={320} aria-label="Labels" search={<MenuSearch autoFocus placeholder="Find a label" />}
        footer={<div {...stylex.props(filterStyles.footer)}><HuePicker value={hue} onChange={setHue} aria-label="New label's color" /><Button size="sm" variant="secondary">New label</Button></div>}>
        {BOARD_LABELS.map((l) => (
          <MenuCheckboxItem key={l.name} closeOnClick={false} icon={<Chip hue={l.hue} dotOnly aria-hidden>{l.name}</Chip>}
            checked={on.has(l.name)} onCheckedChange={(c) => set(l.name, c)}>{l.name}</MenuCheckboxItem>
        ))}
      </MenuContent>
    </Menu>
  );
}
```

### Searchable picker

`MenuSearch` sits above the scroller and owns typing; the product owns filtering. Its magnifier stands in the rows' icon column and the query starts on their labels.

```tsx
import { useState } from "react";
import {
  Menu, MenuContent, MenuEmpty, MenuRadioGroup, MenuRadioItem, MenuSearch,
  MenuTrigger, PickerTrigger,
} from "@arcadia/ui";

function SearchablePicker() {
  const [query, setQuery] = useState("");
  const [model, setModel] = useState("Large model");
  const shown = MODELS.filter((m) => m.toLowerCase().includes(query.trim().toLowerCase()));
  return (
    <Menu onOpenChange={(open) => { if (!open) setQuery(""); }}>
      <MenuTrigger render={<PickerTrigger label={model} />} />
      <MenuContent
        width={240}
        search={
          <MenuSearch
            autoFocus
            placeholder="Search models"
            value={query}
            onChange={(e) => setQuery(e.target.value)}
          />
        }
      >
        {shown.length ? (
          <MenuRadioGroup
            label="Models"
            value={model}
            onValueChange={(v) => setModel(String(v))}
          >
            {shown.map((m) => <MenuRadioItem key={m} value={m}>{m}</MenuRadioItem>)}
          </MenuRadioGroup>
        ) : <MenuEmpty>No matches</MenuEmpty>}
      </MenuContent>
    </Menu>
  );
}
```

### One height while the provider changes

`--menu-h` fixes a menu's height, so a picker that swaps providers keeps its box: only the rows scroll, and the rail, the head and the controls under the list stay where they are. `columnFooter` holds those controls in the column beside the rail.

```tsx
import { useState } from "react";
import {
  Button, Menu, MenuContent, MenuHead, MenuRadioGroup, MenuRadioItem, MenuRail,
  MenuRailTab, MenuTrigger, ProviderMark,
} from "@arcadia/ui";

function SteadyPicker() {
  const [provider, setProvider] = useState("openai");
  const [model, setModel] = useState("Pro 4");
  const [fast, setFast] = useState(false);
  const current = PROVIDERS.find((m) => m.id === provider) ?? PROVIDERS[0]!;
  return (
    <Menu>
      <MenuTrigger render={<Button variant="secondary" size="sm" icon="model">Model</Button>} />
      <MenuContent
        rootStyle={menuStyles.steady}
        width={300}
        aria-label="Models"
        rail={
          <MenuRail value={provider} onValueChange={setProvider} aria-label="Providers">
            {PROVIDERS.map((m) => <MenuRailTab key={m.id} value={m.id} label={m.name} icon={<ProviderMark provider={m.provider} size="lg" />} />)}
          </MenuRail>
        }
        head={<MenuHead title={current.name} detail={current.detail} />}
        columnFooter={
          <div {...stylex.props(filterStyles.footer)}>
            <Button size="sm" icon="usage">Effort High</Button>
            <Button size="sm" icon="zap" pressed={fast} onClick={() => setFast((on) => !on)}>Fast</Button>
          </div>
        }
      >
        <MenuRadioGroup value={model} onValueChange={setModel} aria-label="Model">
          {current.rows.map((row) => <MenuRadioItem key={row} value={row} closeOnClick={false}>{row}</MenuRadioItem>)}
        </MenuRadioGroup>
      </MenuContent>
    </Menu>
  );
}
```

### A view in the surface

A part can show a view of its own in the menu's surface, in place of the rows: `DayFilter` opens its calendar that way, and a submenu drills into its parent where there is no room beside it. The surface never shrinks below the box the rows had, so it stays put under the pointer; a taller view grows it within the room and scrolls inside it.

```tsx
import { useState } from "react";
import {
  DayFilter, Menu, MenuContent, MenuTrigger, PickerTrigger,
} from "@arcadia/ui";

function DateInMenu() {
  const [days, setDays] = useState<DayRange | null>(null);
  return (
    <Menu>
      <MenuTrigger render={<PickerTrigger label={days ? "Custom range" : "Any date"} icon="calendar" />} />
      <MenuContent width={240} align="start" aria-label="Date">
        <DayFilter value={days} onChange={setDays} today={MENU_TODAY} />
      </MenuContent>
    </Menu>
  );
}
```

### A submenu that drills in place

A submenu with no room beside its menu drills in place instead: a back row named for the row that opened it, a hairline, then its own rows. `drill="flush"` stands those rows under the hairline, on the back row inset, and a group label takes the section line rather than the row-tall line it has in a popover. A `MenuOption` on a row takes the same `drill` for its menu. A submenu with room beside its parent opens as a popover, where the option changes nothing.

```tsx
import { useId, useState } from "react";
import {
  Button, Menu, MenuContent, MenuRadioGroup, MenuRadioItem, MenuSub,
  MenuSubContent, MenuSubTrigger, MenuTrigger,
} from "@arcadia/ui";

function DrillFlush({ container }: { container?: HTMLElement }) {
  const id = useId();
  const narrow = useMedia(NARROW);
  const [budget, setBudget] = useState("100k");
  return (
    <div {...sx("cmp-stage-start", cmp.stageStart)}>
      <Menu open modal={false}>
        <MenuTrigger id={id} render={<Button variant="secondary" size="sm" icon="model" iconEnd="chevron-down">Model</Button>} />
        <MenuContent container={container} width={220}>
          <MenuRadioGroup value="aster" onValueChange={copy} label="Model">
            <MenuRadioItem icon="model" value="aster" closeOnClick={false}>Aster</MenuRadioItem>
            <MenuRadioItem icon="model" value="juniper" closeOnClick={false}>Juniper</MenuRadioItem>
          </MenuRadioGroup>
          <MenuSub defaultOpen key={String(narrow)}>
            <MenuSubTrigger drill="flush" icon="memory">Compact at</MenuSubTrigger>
            <MenuSubContent container={container} width={160}>
              <MenuRadioGroup label="Compact at" labelSize="row" value={budget} onValueChange={setBudget}>
                <MenuRadioItem value="50k" closeOnClick={false}>50k</MenuRadioItem>
                <MenuRadioItem value="100k" closeOnClick={false}>100k</MenuRadioItem>
                <MenuRadioItem value="200k" closeOnClick={false}>200k</MenuRadioItem>
              </MenuRadioGroup>
            </MenuSubContent>
          </MenuSub>
        </MenuContent>
      </Menu>
    </div>
  );
}
```

### Opens on whole rows

A menu opens with the checked row in view and, when there is room, the row above it. Rows scroll beneath the search field, with a crisp edge and no fade.

- 18 models, Model O checked

### Groups and toggles

Every row closes the menu when you pick it, checkbox rows too, as macOS menus do, but a set of toggles you set together, such as a filter, passes `closeOnClick={false}` on each row. One setting that modifies another row takes `indicator="switch"`: a switch draws its state, so it never reads as a second pick beside a checked row.

```tsx
import { useState } from "react";
import {
  Button, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuSeparator,
  MenuTrigger,
} from "@arcadia/ui";

function Checkboxes() {
  const [chime, setChime] = useState(true);
  const [tips, setTips] = useState(false);
  const [auto, setAuto] = useState(true);
  return (
    <Menu>
      <MenuTrigger render={<Button variant="secondary" iconEnd="chevron-down">View</Button>} />
      <MenuContent>
        <MenuGroup label="Notifications">
          <MenuCheckboxItem icon="volume" checked={chime} onCheckedChange={setChime}>
            Chime when done
          </MenuCheckboxItem>
          <MenuCheckboxItem icon="info" checked={tips} onCheckedChange={setTips}>
            Show tips
          </MenuCheckboxItem>
        </MenuGroup>
        <MenuSeparator />
        <MenuCheckboxItem indicator="switch" closeOnClick={false} checked={auto} onCheckedChange={setAuto}>
          Auto model
        </MenuCheckboxItem>
      </MenuContent>
    </Menu>
  );
}
```

### States

Rendered open in place: rest, highlighted, a description, a shortcut, disabled, checked, a submenu trigger and danger, at the shared row size. At wide widths the first specimen shows the submenu open.

- Body rows

### Trailing content

`end` takes a dot, a badge or a short text after the label, and gives way first unless it carries state (`endYields={false}`): in a menu too narrow for both it steps down by whole words, then goes whole, while the label keeps its words and the row's tooltip says it all. A row is named for where it leads, never for a state: a dot says something waits there, and the page it opens says what.

- 220px wide: a shortcut, a dot, a state, a long text

### Icon-only items

`MenuIconItem` is an action with no words: a square as tall as the rows, with a row's corners, its glyph the rows' icon, its `label` its accessible name and its tooltip. It stands at the end of a band beside a row, the band's end inset the rows' icon side, and the arrows reach it as they reach any row.

- Sign out beside the account it leaves

### Over its trigger

`over` stands the menu on its trigger: its first row, or its last opening up, lies on the trigger's row to the pixel, the frame one pad round it.

The person's row at a sidebar's foot: press it, and the menu comes round the row without moving it.

```tsx
import {
  Avatar, ListRow, Menu, MenuContent, MenuIconItem, MenuItem, MenuSeparator,
  MenuTrigger,
} from "@arcadia/ui";

function PersonMenu() {
  const person = <Avatar name="ada" size="text" aria-hidden />;
  return (
    <div {...stylex.props(overStyles.foot)}>
      <Menu>
        <MenuTrigger render={<ListRow leading={person} label="ada" emphasis aria-label="Account and settings" />} />
        <MenuContent over side="top">
          <MenuItem icon="settings" shortcut="⌘,">Settings</MenuItem>
          <MenuItem icon="zap">Usage</MenuItem>
          <MenuItem icon="keyboard">Keyboard shortcuts</MenuItem>
          <MenuSeparator />
          <div {...stylex.props(overStyles.band)}>
            <MenuItem icon={person} aria-label="Account, ada" rootStyle={overStyles.wide}>ada</MenuItem>
            <MenuIconItem icon="sign-out" label="Sign out" />
          </div>
        </MenuContent>
      </Menu>
    </div>
  );
}
```

- Closed
- With its menu: the last row is the same row, in the same place

Make that row the trigger's own again, its picture and words where the trigger has them, and the two read as one thing while the menu fades in where it stands: nothing slides and nothing shows twice. It never flips, for the other end holds a different row; short of room it scrolls, that row still in place. Near the window's edge the frame may stand on the edge, never past it, and the row never moves to make room. Its keys and its focus are any menu's.

### Out of its trigger

`morph` opens the menu out of its trigger's box and closes it back into it: the panel is laid out whole at its anchor and a cut grows from the trigger to the panel as it fades in. A composer's model picker opens this way; see it on the Picker trigger page.

[The model chip and its panel](/components/picker-trigger#model-chip)

### Descriptions that give way

A `description` gives way before the label does. Pass a `FadeText` with shorter forms there, such as a folder's last two names, and it uses an ellipsis only when the shortest still doesn't fit.

- 240px wide: three folders, each said as fits

## Context menu

`ContextMenu` opens the same menu on the object itself: at the pointer on a right click or a long press, or under the focused element on the menu key or Shift+F10.

Use it for the actions of one object, opened where the person already points: a file, a row, a canvas. It is hard to discover, so keep every action in it reachable another way too, such as the row's More menu or a toolbar.

In Act, a file list's rows open their actions on a right click: Open, Copy path and Rename, then Delete last.

```tsx
import {
  ContextMenu, ContextMenuContent, ContextMenuTrigger, ListRow, MenuItem,
  MenuSeparator,
} from "@arcadia/ui";

<ContextMenu>
  <ContextMenuTrigger {...sx("cmp-rows", cmp.rows)}>
    <ListRow leading="file-code" label="dialog.tsx" description="src/settings" />
    <ListRow leading="file-code" label="settings.css" description="src/settings" />
    <ListRow leading="file-text" label="README.md" />
  </ContextMenuTrigger>
  <ContextMenuContent>
    <MenuItem icon="external" shortcut="mod+o">Open</MenuItem>
    <MenuItem icon="copy">Copy path</MenuItem>
    <MenuItem icon="pencil" shortcut="F2">Rename…</MenuItem>
    <MenuSeparator />
    <MenuItem icon="trash" tone="danger" shortcut="⇧⌘⌫">Delete</MenuItem>
  </ContextMenuContent>
</ContextMenu>
```

```tsx
import {
  ContextMenu, ContextMenuContent, ContextMenuTrigger, ListRow, MenuItem,
} from "@arcadia/ui";

<ContextMenu>
  <ContextMenuTrigger>
    <ListRow leading="file-code" label="dialog.tsx" />
  </ContextMenuTrigger>
  <ContextMenuContent>
    <MenuItem icon="pencil">Rename…</MenuItem>
    <MenuItem icon="trash" tone="danger">Delete</MenuItem>
  </ContextMenuContent>
</ContextMenu>
```

The trigger is a `<div>` around whatever owns the menu: a row, a list, a canvas. A right click or a long press opens the content at the pointer. Every part above works inside it, at the same 28px Body rows: items, groups, checks and submenus.

From the keyboard, the menu key or Shift+F10 opens it on whatever has focus inside the trigger: under that element, as a menu stands under its trigger, in one frame, with its first row lit. The event a system sends after its own menu key is the same open, not a second one.

### From the keyboard

Tab to a file and press Shift+F10, or the menu key: the menu stands under the focused row, never over it, and Escape gives the row its focus back.

```tsx
import {
  ContextMenu, ContextMenuContent, ContextMenuTrigger, ListRow, MenuItem,
  MenuSeparator,
} from "@arcadia/ui";

<ContextMenu>
  <ContextMenuTrigger {...sx("cmp-rows", cmp.rows)}>
    <ListRow leading="file-code" label="dialog.tsx" description="src/settings" />
    <ListRow leading="file-code" label="settings.css" description="src/settings" />
    <ListRow leading="file-text" label="README.md" />
  </ContextMenuTrigger>
  <ContextMenuContent>
    <MenuItem icon="external" shortcut="mod+o">Open</MenuItem>
    <MenuItem icon="copy">Copy path</MenuItem>
    <MenuItem icon="pencil" shortcut="F2">Rename…</MenuItem>
    <MenuSeparator />
    <MenuItem icon="trash" tone="danger" shortcut="⇧⌘⌫">Delete</MenuItem>
  </ContextMenuContent>
</ContextMenu>
```

## Menu with a rail

A picker over many sections: a rail of their marks beside the chosen section's rows, and one option chip on a row or on the head.

Use it for a choice across many sections, one section shown at a time, with a search that reaches every section and a chosen row's one setting opened beside the list. A list with no sections needs no rail. A picker or a question docked to a composer is a `Tray`.

In Act, a picker across projects, branches and machines stands in a rail beside its rows, and its head names the chosen section.

```tsx
<RailPicker />
```

```tsx
import {
  MenuContent, MenuHead, MenuOption, MenuRadioGroup, MenuRadioItem, MenuRail,
  MenuRailTab,
} from "@arcadia/ui";

<MenuContent
  rail={<MenuRail value="projects" onValueChange={() => {}} aria-label="Sections">
    <MenuRailTab value="projects" label="Projects" icon="folder" />
    <MenuRailTab value="branches" label="Branches" icon="branch" />
  </MenuRail>}
  head={<MenuHead title="Projects" detail="Synced" />}
>
  <MenuRadioGroup value="acme-web" aria-label="Projects">
    <MenuRadioItem value="acme-web" option={<MenuOption label="High" aria-label="Priority">{null}</MenuOption>}>acme-web</MenuRadioItem>
    <MenuRadioItem value="acme-api">acme-api</MenuRadioItem>
  </MenuRadioGroup>
</MenuContent>
```

For a choice across many sections: `MenuContent` takes a `MenuRail` (`rail`) and a `MenuHead` (`head`), and its rows are the chosen section's. The rail holds one `MenuRailTab` per section, its mark at 16px in a 28px tab, the chosen one on a fill; its name is the tooltip. The head names the section once, a detail after it in the quiet ink. The chosen row is an ink fill in Body bold, no check, and may end in one `MenuOption`: a chip that opens a menu beside the whole menu, level with its row. A head may end in one too, the same part.

A search reaches every section: give the rail a `null` value while it narrows, and say each row's section in its `description`. The rail's `foot` takes one control at its end. A section in trouble lights its tab's corner.

Up and Down stay within the focused column. Press toward the rail to focus its selected tab, or toward the rows to return to the highlighted or checked row. Those directions reverse in a right-to-left layout.

### Open settings from a model row

Pick Aster or Juniper to open effort without leaving the list. Willow picks and closes without a second panel.

```tsx
import { useState } from "react";
import {
  Menu, MenuContent, MenuOption, MenuRadioGroup, MenuRadioItem, MenuTrigger,
  PickerTrigger,
} from "@arcadia/ui";

function ModelOptions() {
  const [model, setModel] = useState("Aster");
  const [option, setOption] = useState<string>();
  return (
    <Menu onOpenChange={open => { if (!open) setOption(undefined); }}>
      <MenuTrigger render={<PickerTrigger label={model} />} />
      <MenuContent aria-label="Models">
        <MenuRadioGroup value={model} onValueChange={setModel}>
          {["Aster", "Juniper"].map(name => (
            <MenuRadioItem key={name} value={name} openOptionOnPick option={
              <MenuOption label="Effort" aria-label={`${name} effort`} width={200} open={option === name}
                onOpenChange={open => setOption(current => open ? name : current === name ? undefined : current)}>
                <MenuRadioGroup label="Effort" defaultValue="Normal">
                  {LEVELS.map(level => <MenuRadioItem key={level} value={level}>{level}</MenuRadioItem>)}
                </MenuRadioGroup>
              </MenuOption>
            }>{name}</MenuRadioItem>
          ))}
          <MenuRadioItem value="Willow">Willow</MenuRadioItem>
          <MenuRadioItem value="Birch" disabled end="Unavailable">Birch</MenuRadioItem>
        </MenuRadioGroup>
      </MenuContent>
    </Menu>
  );
}
```

### Open, with the row's option

Rendered open in place: the rail, the head with its option, the chosen row's chip and the menu it opens beside the whole menu.

- Three sections

### Sections across the top

A popover too narrow for a rail beside its rows takes the rail on its side: `MenuRail orientation="row"` in `MenuContent tabs`, over the search. Left and Right cross sections, Down goes to the rows, and the rows keep their check.

```tsx
import { useState } from "react";
import {
  Icon, IconButton, Menu, MenuCheckboxItem, MenuContent, MenuEmpty, MenuHead,
  MenuOption, MenuRadioGroup, MenuRadioItem, MenuRail, MenuRailTab, MenuSearch,
  MenuTrigger, ModelChip, ProviderMark,
} from "@arcadia/ui";

function TopTabs() {
  const [provider, setProvider] = useState<string>("openai");
  const [model, setModel] = useState<string>("Pro 4");
  const [account, setAccount] = useState<string>("Work");
  const [compact, setCompact] = useState("Half");
  const [fast, setFast] = useState(false);
  const [query, setQuery] = useState("");
  const q = query.trim().toLowerCase();
  const shown = TOP_PROVIDERS.find((p) => p.id === provider) ?? TOP_PROVIDERS[0];
  const rows = q ? TOP_PROVIDERS.flatMap((p) => p.rows.filter((r) => r.name.toLowerCase().includes(q))) : shown.rows;
  const chosen = TOP_PROVIDERS.find((p) => p.rows.some((r) => r.name === model)) ?? shown;
  return (
    <Menu onOpenChange={(o) => { if (!o) setQuery(""); }}>
      <MenuTrigger render={<ModelChip provider={chosen.provider} label={model} tail={fast ? <Icon name="zap" filled /> : undefined}
        aria-label={`Model: ${chosen.name} ${model}${fast ? ", Fast" : ""}`} />} />
      <MenuContent width={344} aria-label="Models"
        tabs={
          <MenuRail orientation="row" value={q ? null : provider} onValueChange={(v) => { setQuery(""); setProvider(v); }} aria-label="Providers"
            lead={<IconButton icon="star" label="Favorites" variant="ghost" />}
            foot={<IconButton icon="settings" label="Choose models" variant="ghost" />}>
            {TOP_PROVIDERS.map((p) => <MenuRailTab key={p.id} value={p.id} label={p.name} icon={<ProviderMark provider={p.provider} size="md" />} />)}
          </MenuRail>
        }
        search={<MenuSearch icon={false} autoFocus placeholder="Search models" value={query} onChange={(e) => setQuery(e.target.value)} />}
        head={q ? undefined : (
          <MenuHead detail={`${account} account`} option={
            <MenuOption label="" icon="more" aria-label={`${shown.name} account`} width={200}>
              <MenuRadioGroup value={account} onValueChange={(v) => setAccount(String(v))}>
                {shown.accounts.map((a) => <MenuRadioItem key={a} value={a}>{a}</MenuRadioItem>)}
              </MenuRadioGroup>
            </MenuOption>
          } />
        )}
        columnFooter={<MenuCheckboxItem indicator="switch" closeOnClick={false} checked={fast} onCheckedChange={setFast}>Fast</MenuCheckboxItem>}
      >
        {rows.length ? (
          <MenuRadioGroup value={model} onValueChange={(v) => setModel(String(v))} aria-label={q ? "Matches" : shown.name}>
            {rows.map((r) => (
              <MenuRadioItem key={r.name} value={r.name} closeOnClick={false} stackDescription description={r.note} check={false}
                end={r.name === model ? <Icon name="check" /> : undefined}
                option={r.name === model ? (
                  <MenuOption label="" aria-label={`Compact at: ${compact}`} width={200}>
                    <MenuRadioGroup label="Compact at" labelSize="row" value={compact} onValueChange={(v) => setCompact(String(v))}>
                      {COMPACT_AT.map((c) => <MenuRadioItem key={c} value={c} closeOnClick={false}>{c}</MenuRadioItem>)}
                    </MenuRadioGroup>
                  </MenuOption>
                ) : undefined}>{r.name}</MenuRadioItem>
            ))}
          </MenuRadioGroup>
        ) : <MenuEmpty>No matches</MenuEmpty>}
      </MenuContent>
    </Menu>
  );
}
```

The menu stands on an 8px pad, and every hairline has as much room above as below. The band of tabs takes a `lead` before them and its `foot` at the trailing edge. The search under it stands a step taller, and `icon={false}` drops its glyph where the rows name what it finds. The head is one row tall on the rows' box, the first row right under it, and a head with only a `detail` names an account. An option with no label is its glyph alone, a ghost whose press covers the whole head line.

A row may carry its `description` under its label (`stackDescription`), and `check={false}` leaves the check to its own `end`. A group label that heads a small menu takes `labelSize="row"`: a row tall, the pad under it.

## Swatch row

`MenuSwatchRow` puts a short choice among colour marks in one row of a menu or a context menu: arrows go across the swatches, and the row wraps at narrow widths.

Use it for a colour picked from the object's own menu, such as a project's folder colour, the monochrome default drawn as a hollow ring. A choice in words is a `MenuRadioGroup`, and one that needs a line of what it means is a `ChoiceList`.

In Act, a project row's colour choice sits inline in its menu, between New chat and Copy path, and closes the menu on a pick.

```tsx
import { useState } from "react";
import {
  ContextMenu, ContextMenuContent, ContextMenuTrigger, Icon, ListRow, MenuItem,
  MenuSeparator, MenuSwatchRow,
} from "@arcadia/ui";

function ProjectMenu() {
  const [color, setColor] = useState<IconColor>("blue");
  return (
    <ContextMenu>
      <ContextMenuTrigger {...sx("cmp-rows", cmp.rows)}>
        <ListRow leading={<FolderMark color={color} />} label="northwind-web" description="Right click to change icon color" />
      </ContextMenuTrigger>
      <ContextMenuContent>
        <MenuItem icon="new-chat">New chat</MenuItem>
        <MenuSeparator />
        <MenuSwatchRow label="Icon color" choices={ICON_CHOICES} value={color} onChange={setColor} />
        <MenuItem icon="copy">Copy path</MenuItem>
        <MenuItem icon="settings">Project settings</MenuItem>
        <MenuSeparator />
        <MenuItem icon="trash" tone="danger">Remove project</MenuItem>
      </ContextMenuContent>
    </ContextMenu>
  );
}
```

```tsx
import {
  Icon, MenuContent, MenuItem, MenuSeparator, MenuSwatchRow,
} from "@arcadia/ui";

<MenuContent>
  <MenuItem icon="new-chat">New chat</MenuItem>
  <MenuSeparator />
  <MenuSwatchRow label="Icon color" choices={ICON_CHOICES} value={picked} onChange={setPicked} />
  <MenuItem icon="copy">Copy path</MenuItem>
</MenuContent>
```

A short choice among colour marks lives inline in the menu row, never in a submenu or a replaced menu view. Each choice is a `Swatch` at `sm` (24px target, 12px disc) with its accessible name and tooltip. Omit `color` for the monochrome default, which draws as a hollow ring at the icon stroke weight.

The chosen swatch carries an ink ring rather than colour alone, and switches to the system highlight under forced colours. A pointer's pick carries the ring to the new swatch; it lands whole from the keyboard, across a wrap, or under reduced motion. Picking a swatch closes the menu by default; pass `closeOnClick={false}` when the menu stays open to preview changes.

### Open inside a context menu

Eight choices fit on one line at the menu's default width.

### Constrained menu widths

At narrow widths the swatches wrap to a second line rather than clipping or opening another popover.

- 200px menu
- 160px menu

### A disabled row

Disabling the row dims the label, skips the row on arrow keys and blocks selection.

## Customising

`MenuContent` takes where the menu sits and the menu knobs below, and each row (`MenuItem`, `MenuRadioItem` and the rest) takes the row knobs. [Theming](/foundations/theming) says what else a product may change.

- `--menu-min-w` (`TokenRef<Measure>`, default `180px`): Narrowest width (180); the trigger's width when wider.
- `--menu-max-w` (`TokenRef<Measure>`, default `320px`): Widest width (320).
- `--menu-max-h` (`TokenRef<Measure>`, default `420px`): Tallest height (420); the space left beside the trigger when less.
- `--menu-h` (`TokenRef<Measure> | Derived | "auto"`, default `auto`): A fixed height, so a menu of changing rows holds its box; `auto` fits the rows. `--menu-max-h` and the space left beside the trigger still cap it.
- `--menu-radius` (`TokenRef<Radius>`, default `var(--radius-frame)`): Corner radius.
- `--menu-pad` (`TokenRef<Space>`, default `calc((var(--space-1) + var(--space-1-5)) / 2)`): Padding around the rows (5).
- `--menu-gap` (`TokenRef<Space>`, default `0px`): Gap between rows.
- `--menu-item-radius` (`TokenRef<Radius>`, default `var(--radius-inset)`): Row corner radius (the highlight follows it).
- `--menu-sep-block` (`TokenRef<Space>`, default `var(--space-1)`): Space above and below a separator.
- `--menu-search-block` (`TokenRef<Space>`, default `var(--space-3)`): Space above and below the search, under a rail (12).
- `--menu-footer-block` (`TokenRef<Space>`, default `var(--menu-pad)`): Space above and below the footer under the rows (the menu pad).
- `--menu-item-inset` (`TokenRef<Space>`, default `var(--row-inset)`): The words of a row, the search and the footers, in from its edges (8).

A menu whose rows change keeps one height: `--menu-h` fixes its box (a measure token, or a `min(...)` of one and the room), `auto` fitting its rows as every menu does, while `--menu-max-h` and the room beside the trigger still cap it. `columnFooter` is a strip under the list, inside the column beside the rail, at the rows' inset: a model's effort and speed stay beside the models they change, and the full-width `footer` still stands below the whole body.

Item corners come from `--menu-radius` and `--menu-pad` through `nest`: the frame's 12 less the pad of 4 is an 8 concentric with it, and a wider pad keeps 8, clear of the corner.

- `--menu-item-fg` (`Paint`, default `var(--text-1)`): Label colour.
- `--menu-item-fg-disabled` (`Paint`, default `var(--text-4)`): Label colour when disabled.
- `--menu-item-icon` (`Paint`, default `var(--icon-2)`): Leading icon colour (an element icon such as a provider mark reads it too).
- `--menu-item-icon-hl` (`Paint`, default `var(--icon-1)`): Leading icon colour while the row is highlighted or its submenu is open.
- `--menu-item-icon-disabled` (`Paint`, default `var(--icon-4)`): Leading icon colour when disabled.
- `--menu-item-fill` (`Paint`, default `var(--fill-3)`): The highlight's fill under the pointer (drawn by the menu's Glide).
- `--menu-item-fill-kbd` (`Paint`, default `var(--fill-2)`): The highlight's fill while the keyboard drives it: a step stronger.

Each state reads its own knob (`--menu-item-icon-hl`, `--menu-item-fill-kbd`, `--menu-item-fg-disabled`), so a knob you set never drops a state. An element icon, such as a provider mark, takes the row's icon colour too.

## Accessibility

The APG menu pattern: the trigger gets `aria-haspopup` and `aria-expanded`, focus moves into the menu and returns to the trigger on close. A row's `shortcut` is drawn only (`aria-hidden`, so the row reads "Rename", not "Rename F2") and exposed as `aria-keyshortcuts`.

- ↓ + ↑: Move the highlight
- Enter + Space: Activate the highlighted row
- →: Open a submenu
- ←: Close a submenu
- Esc: Close the menu
- A to Z: Jump to a row by its first letters
- Tab: To each control of the menu's own, a footer's, in order; past the last, close the menu and move on
- Shift Tab: Back; from a row, back to the search field

### With a search field

An input may not sit inside `role="menu"`, so a searchable menu moves the roles: the popup is a group labelled by the trigger, the field is a combobox (`aria-controls` the menu, `aria-activedescendant` on the lit row, `aria-autocomplete="list"`) and the scroller is the menu.

- A to Z: Filter; the first match lights up
- Enter: Pick the lit row
- ↓ + ↑: Move focus onto the lit row (the first press never skips it); then the menu's keys apply
- A to Z on a row: Back to the field, the key included
- Esc: Close the menu

### In a context menu

Once open, focus moves into the menu and returns on close to what had it. On a touch screen a long press opens it at the finger, and lifting that finger never activates what lies under it.

- shift+F10: Open it on what has focus, as the menu key does
- Esc: Close and give focus back to what had it

### With a rail

The popup is a group: the field a combobox, the rail a vertical `tablist` whose tabs are named by their labels, the rows a menu. A row's chip is drawn, not focused: the row speaks for it, and its keys reach it. A head's chip is a button with `aria-haspopup` and `aria-expanded`. Under forced colours, which drop every fill, the chosen section and the chosen row stand on the system's highlight.

- Tab: Move between the field, the rail, the head's option and the rows
- ↓ + ↑: Move through the rows; past a section's last row into the next one's first
- ← + →: Step the chosen row's option in menus that opt into stepping
- Enter + Space + →: On a model row with settings: pick and open its option
- ←: In a model option row: go back to the model
- ↓ + ↑: In the rail: choose a section
- Enter + →: In the rail: go to the rows. On the head's option: open it
- Esc: Close the option's menu, then clear the search, then close

### In a swatch row

The row is a `role="group"` named by its visible `label`, holding `role="menuitemradio"` buttons with `aria-checked`, `aria-label`, `aria-posinset` and `aria-setsize`. Every swatch is a 24px target, and its chosen state is an ink ring, never colour alone.

- ↓ / ↑: Move between menu rows; landing on the swatch row focuses the checked swatch
- → / ←: Move across the swatches in the row (wraps at both ends)
- Home / End: Move to the first or last swatch in the row
- Enter / Space: Pick the focused swatch and close the menu
- Esc: Close the menu without changing the colour and return focus to the trigger
- Tab: Close the menu and move focus on from the trigger

## API reference

### Menu

- `open` (`boolean`): Controlled open state.
- `defaultOpen` (`boolean`, default `false`): Initial open state when uncontrolled.
- `onOpenChange` (`(open: boolean, details: OpenChangeDetails) => void`): Called when the menu opens or closes, with why (`details.reason`) and the event.
- `onOpenChangeComplete` (`(open: boolean) => void`): Called once the open or close transition has finished.
- `modal` (`boolean`, default `true`): Lock page scroll and pointer interaction outside while open.

### MenuTrigger

- `render` (`RenderProp<{ disabled: boolean }>`): Replace the rendered element, e.g. `render={<a href="/settings" />}`, or a function of props and state.
- `disabled` (`boolean`): Native disabled: no pointer events, no tooltip, skipped by Tab.
- `focusableWhenDisabled` (`boolean`): Keep a disabled control focusable and hoverable (`aria-disabled`), so a tooltip can say why.
- `nativeButton` (`boolean`): Button semantics, inferred from what renders: a `<button>` is native, an `<a>` stays a link, anything else gets `role="button"` and key handling. `false` forces button semantics on whatever renders (a link acting as a button).

Rest props go to `<button>` props.

### MenuContent

- `rootStyle` (`MenuStyle`): Typed StyleX override: where the menu sits (layout) and its `--menu-*` knobs.
- `side` (`"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"`, default `"bottom"`)
- `align` (`"start" | "center" | "end"`, default `"start"`)
- `over` (`boolean`): The menu stands over its trigger instead of beside it: its first row (its last with `side="top"`) lies on the trigger's edges, at least as wide, the frame one pad round it, so the trigger's row and that row are one and never move as it opens. It fades in where it stands and never flips: short of room it scrolls, that row still in place. Make that row the trigger's own again (the person's row in their menu). `align` `start` or `end`; the offsets do not apply. A `Menu` only.
- `sideOffset` (`number`, default `6`)
- `alignOffset` (`number`)
- `collisionPadding` (`number`)
- `aria-label` (`string`): The menu's name where its trigger doesn't give one: a context menu ("Chat actions"; default "Context menu"), or with `search`, what the list under the field holds ("Models", "Projects").
- `width` (`"auto" | "trigger" | number`): `auto` (as wide as its content, 180 to 320px), `trigger` (exactly the trigger's width) or a pixel width.
- `search` (`ReactNode`): A `<MenuSearch/>` row, rendered above the scroller so it never scrolls away.
- `footer` (`ReactNode`): A band under the rows, never scrolled.
- `columnFooter` (`ReactNode`): A band under the list, inside the column beside a `rail`: a strip of controls that never scrolls with the rows.
- `rail` (`ReactNode`): A `MenuRail` of sections beside the rows, which are the chosen section's: Tab moves between the search, the rail, its stops and the rows, ↑↓ cross sections, the chosen row is an ink fill with no check, Esc clears the search first.
- `tabs` (`ReactNode`): A `MenuRail orientation="row"` across the menu's top, over the search: sections for a menu too narrow for a rail beside it. The rows keep their check.
- `head` (`ReactNode`): A `MenuHead` over the rows, beside the rail, never scrolled.
- `inline` (`boolean`)
- `container` (`PortalContainer`, default `document.body`): Portal container.
- `instant` (`boolean`): Skip the open/close transition (re-anchoring from one picker to the next).
- `morph` (`boolean`): Open out of the trigger's box and close back into it (a composer's model picker, O60): the surface is laid out whole at its anchor and a clip grows from the trigger's box to its own as it fades in. Not with `over`.
- `finalFocus` (`FocusTarget`): Where focus goes on close. Default: the trigger.

Rest props go to `<div>` props.

### MenuItem

- `tone` (`"neutral" | "danger"`, default `"neutral"`): `danger` tints label, icon and highlight red (destructive actions).
- `onClick` (`(e: MouseEvent<HTMLElement>) => void`): Runs the action.
- `disabled` (`boolean`): Skipped by the keyboard and the pointer, drawn at text-4.
- `closeOnClick` (`boolean`, default `true`): Close the menu after the action. Default true for every row, a checkbox row too, as macOS menus do; a set of toggles set together passes false.
- `label` (`string`): The text typeahead matches (default: the row's text).
- `icon` (`IconName | ReactElement`): Leading icon: a registry name or an element (a dot, an avatar); an Icon takes the row's icon colour.
- `description` (`ReactNode`): Secondary text after the label, text-3 (e.g. effort "High" after a model name).
- `shortcut` (`ShortcutSpec`): Trailing shortcut hint, text-3: `"⇧⌘D"`, `["⌘","K"]` or `"mod+shift+d"`.
- `end` (`ReactNode`): Extra trailing content (a badge, a dot, an external-link icon); it takes the row's end colour, text-3.
- `endYields` (`boolean`): `false`: a text end that carries state keeps its words while the label steps down to `apart`.
- `descriptionYields` (`boolean`): `false`: as `endYields`.
- `apart` (`number`): The label's forms that tell it from the menu's other rows (`apartForms`).
- `rootStyle` (`MenuItemStyle`): Typed StyleX override: where the row sits (layout) and its `--menu-item-*` knobs.

Rest props go to `<div>` props.

### MenuIconItem

- `icon` (`IconName`, required)
- `label` (`string`, required): Required: its accessible name, its tooltip and the text typeahead matches.
- `tone` (`"neutral" | "danger"`, default `"neutral"`): `danger` tints the glyph and highlight red.
- `rootStyle` (`MenuItemStyle`): Typed StyleX override: where the item sits (layout) and its `--menu-item-*` knobs.
- `onClick` (`(e: MouseEvent<HTMLElement>) => void`): Runs the action.
- `disabled` (`boolean`): Skipped by the keyboard and the pointer, drawn at text-4.
- `closeOnClick` (`boolean`, default `true`): Close the menu after the action. Default true for every row, a checkbox row too, as macOS menus do; a set of toggles set together passes false.

Rest props go to `<div>` props.

### MenuCheckboxItem

- `indicator` (`"check" | "switch"`, default `"check"`): The state at the row's end. `check`: one of a set picked together. `switch`: one setting that modifies another row (the model's long context). The row stays the one control.
- `checked` (`boolean`): Controlled checked state.
- `defaultChecked` (`boolean`, default `false`): Initial checked state when uncontrolled.
- `onCheckedChange` (`(checked: boolean, details: { event: Event }) => void`): Called with the new state when the row is pressed.
- `onClick` (`(e: MouseEvent<HTMLElement>) => void`): Runs the action.
- `disabled` (`boolean`): Skipped by the keyboard and the pointer, drawn at text-4.
- `closeOnClick` (`boolean`, default `true`): Close the menu after the action. Default true for every row, a checkbox row too, as macOS menus do; a set of toggles set together passes false.
- `label` (`string`): The text typeahead matches (default: the row's text).
- `icon` (`IconName | ReactElement`): Leading icon: a registry name or an element (a dot, an avatar); an Icon takes the row's icon colour.
- `description` (`ReactNode`): Secondary text after the label, text-3 (e.g. effort "High" after a model name).
- `shortcut` (`ShortcutSpec`): Trailing shortcut hint, text-3: `"⇧⌘D"`, `["⌘","K"]` or `"mod+shift+d"`.
- `end` (`ReactNode`): Extra trailing content (a badge, a dot, an external-link icon); it takes the row's end colour, text-3.
- `endYields` (`boolean`): `false`: a text end that carries state keeps its words while the label steps down to `apart`.
- `descriptionYields` (`boolean`): `false`: as `endYields`.
- `apart` (`number`): The label's forms that tell it from the menu's other rows (`apartForms`).
- `rootStyle` (`MenuItemStyle`): Typed StyleX override: where the row sits (layout) and its `--menu-item-*` knobs.

Rest props go to `<div>` props.

### MenuRadioGroup

- `label` (`ReactNode`): Section label (an eyebrow), the group's accessible name.
- `labelSize` (`"section" | "row"`): The label's line: see `MenuLabel size`.
- `value` (`T`): The checked row's value (controlled).
- `defaultValue` (`T`)
- `onValueChange` (`(value: T, details: { event: Event }) => void`): Called with the picked row's value.
- `disabled` (`boolean`, default `false`)

Rest props go to `<div>` props.

### MenuRadioItem

- `value` (`unknown`, required): This choice's value.
- `option` (`ReactNode`): One `MenuOption` at the row's end (the chosen row's level and settings), in the check's place.
- `openOptionOnPick` (`boolean`): Pick and open the trailing option on press, tap, Enter, Space or Right. A row without an option still just picks.
- `check` (`boolean`, default `true`): `false`: no trailing check, for a row whose own `end` says it is the chosen one.
- `stackDescription` (`boolean`): The description under the label rather than beside it: a row two lines tall.
- `chosenFill` (`boolean`, default `false`): The chosen row takes the fill, with no check and no rail to say it: for a `check={false}` row whose own `end` carries the choice (a model row, its threshold and drill at its end). Default false: a row with a check, or in a menu with a rail, is filled already.
- `onClick` (`(e: MouseEvent<HTMLElement>) => void`): Runs the action.
- `disabled` (`boolean`): Skipped by the keyboard and the pointer, drawn at text-4.
- `closeOnClick` (`boolean`, default `true`): Close the menu after the action. Default true for every row, a checkbox row too, as macOS menus do; a set of toggles set together passes false.
- `label` (`string`): The text typeahead matches (default: the row's text).
- `icon` (`IconName | ReactElement`): Leading icon: a registry name or an element (a dot, an avatar); an Icon takes the row's icon colour.
- `description` (`ReactNode`): Secondary text after the label, text-3 (e.g. effort "High" after a model name).
- `shortcut` (`ShortcutSpec`): Trailing shortcut hint, text-3: `"⇧⌘D"`, `["⌘","K"]` or `"mod+shift+d"`.
- `end` (`ReactNode`): Extra trailing content (a badge, a dot, an external-link icon); it takes the row's end colour, text-3.
- `endYields` (`boolean`): `false`: a text end that carries state keeps its words while the label steps down to `apart`.
- `descriptionYields` (`boolean`): `false`: as `endYields`.
- `apart` (`number`): The label's forms that tell it from the menu's other rows (`apartForms`).
- `rootStyle` (`MenuItemStyle`): Typed StyleX override: where the row sits (layout) and its `--menu-item-*` knobs.

Rest props go to `<div>` props.

### MenuGroup

- `label` (`ReactNode`): Section label (an eyebrow), the group's accessible name.
- `labelSize` (`"section" | "row"`): The label's line: see `MenuLabel size`.

Rest props go to `<div>` props.

### MenuSearch

- `icon` (`IconName | false`, default `"search"`): Leading glyph; default `search`. `false`: none, for a list whose rows name what it finds.
- `autoFocus` (`boolean`): Focus the field when the menu opens.

Rest props go to `<input>` props.

### MenuSubTrigger

- `delay` (`number`, default `0`): Hover open delay in ms.
- `drill` (`"padded" | "flush"`): How this submenu stands where it has no room beside the menu and drills in place instead (a menu 390 wide): `padded`, the menu pad above its rows, the default, or `flush`, the rows under the back rule and a group label on the section line. With room beside its parent it opens as a popover either way.
- `onClick` (`(e: MouseEvent<HTMLElement>) => void`): Runs the action.
- `disabled` (`boolean`): Skipped by the keyboard and the pointer, drawn at text-4.
- `closeOnClick` (`boolean`, default `false`): Close the menu after the action. Default true for every row, a checkbox row too, as macOS menus do; a set of toggles set together passes false.
- `label` (`string`): The text typeahead matches (default: the row's text).
- `icon` (`IconName | ReactElement`): Leading icon: a registry name or an element (a dot, an avatar); an Icon takes the row's icon colour.
- `description` (`ReactNode`): Secondary text after the label, text-3 (e.g. effort "High" after a model name).
- `end` (`ReactNode`): Extra trailing content (a badge, a dot, an external-link icon); it takes the row's end colour, text-3.
- `endYields` (`boolean`): `false`: a text end that carries state keeps its words while the label steps down to `apart`.
- `descriptionYields` (`boolean`): `false`: as `endYields`.
- `apart` (`number`): The label's forms that tell it from the menu's other rows (`apartForms`).
- `rootStyle` (`MenuItemStyle`): Typed StyleX override: where the row sits (layout) and its `--menu-item-*` knobs.

Rest props go to `<div>` props.

### MenuSubContent

- `rootStyle` (`MenuStyle`): Typed StyleX override: where the menu sits (layout) and its `--menu-*` knobs.
- `sideOffset` (`number`, default `6`)
- `alignOffset` (`number`)
- `collisionPadding` (`number`)
- `aria-label` (`string`): The menu's name where its trigger doesn't give one: a context menu ("Chat actions"; default "Context menu"), or with `search`, what the list under the field holds ("Models", "Projects").
- `width` (`"auto" | "trigger" | number`): `auto` (as wide as its content, 180 to 320px), `trigger` (exactly the trigger's width) or a pixel width.
- `search` (`ReactNode`): A `<MenuSearch/>` row, rendered above the scroller so it never scrolls away.
- `footer` (`ReactNode`): A band under the rows, never scrolled.
- `columnFooter` (`ReactNode`): A band under the list, inside the column beside a `rail`: a strip of controls that never scrolls with the rows.
- `rail` (`ReactNode`): A `MenuRail` of sections beside the rows, which are the chosen section's: Tab moves between the search, the rail, its stops and the rows, ↑↓ cross sections, the chosen row is an ink fill with no check, Esc clears the search first.
- `tabs` (`ReactNode`): A `MenuRail orientation="row"` across the menu's top, over the search: sections for a menu too narrow for a rail beside it. The rows keep their check.
- `head` (`ReactNode`): A `MenuHead` over the rows, beside the rail, never scrolled.
- `inline` (`boolean`)
- `container` (`PortalContainer`, default `document.body`): Portal container.
- `instant` (`boolean`): Skip the open/close transition (re-anchoring from one picker to the next).
- `morph` (`boolean`): Open out of the trigger's box and close back into it (a composer's model picker, O60): the surface is laid out whole at its anchor and a clip grows from the trigger's box to its own as it fades in. Not with `over`.
- `finalFocus` (`FocusTarget`): Where focus goes on close. Default: the trigger.

Rest props go to `<div>` props.

### ContextMenu

- `open` (`boolean`): Controlled open state.
- `onOpenChange` (`(open: boolean, details: OpenChangeDetails) => void`): Called when the menu opens or closes, with why (`details.reason`) and the event.
- `onOpenChangeComplete` (`(open: boolean) => void`): Called once the open or close transition has finished.

### ContextMenuTrigger

- `render` (`RenderProp`): Render another element in place of the `div`.
- `disabled` (`boolean`): The browser's own menu here; turning it on later remounts nothing inside.

Rest props go to `<div>` props.

### ContextMenuContent

- `rootStyle` (`MenuStyle`): Typed StyleX override: where the menu sits (layout) and its `--menu-*` knobs.
- `side` (`"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"`, default `"bottom"`)
- `align` (`"start" | "center" | "end"`, default `"start"`)
- `sideOffset` (`number`, default `6`)
- `alignOffset` (`number`)
- `collisionPadding` (`number`)
- `aria-label` (`string`): The menu's name where its trigger doesn't give one: a context menu ("Chat actions"; default "Context menu"), or with `search`, what the list under the field holds ("Models", "Projects").
- `width` (`"auto" | "trigger" | number`): `auto` (as wide as its content, 180 to 320px), `trigger` (exactly the trigger's width) or a pixel width.
- `search` (`ReactNode`): A `<MenuSearch/>` row, rendered above the scroller so it never scrolls away.
- `footer` (`ReactNode`): A band under the rows, never scrolled.
- `columnFooter` (`ReactNode`): A band under the list, inside the column beside a `rail`: a strip of controls that never scrolls with the rows.
- `rail` (`ReactNode`): A `MenuRail` of sections beside the rows, which are the chosen section's: Tab moves between the search, the rail, its stops and the rows, ↑↓ cross sections, the chosen row is an ink fill with no check, Esc clears the search first.
- `tabs` (`ReactNode`): A `MenuRail orientation="row"` across the menu's top, over the search: sections for a menu too narrow for a rail beside it. The rows keep their check.
- `head` (`ReactNode`): A `MenuHead` over the rows, beside the rail, never scrolled.
- `inline` (`boolean`)
- `container` (`PortalContainer`, default `document.body`): Portal container.
- `instant` (`boolean`): Skip the open/close transition (re-anchoring from one picker to the next).
- `morph` (`boolean`): Open out of the trigger's box and close back into it (a composer's model picker, O60): the surface is laid out whole at its anchor and a clip grows from the trigger's box to its own as it fades in. Not with `over`.
- `finalFocus` (`FocusTarget`): Where focus goes on close. Default: the trigger.

Rest props go to `<div>` props.

### MenuRail

- `value` (`string | null`, required): The chosen section; `null`: none (a search across every section lets go of it).
- `onValueChange` (`(value: string) => void`, required): Called with a section's value when its tab is pressed or reached with ↑↓ in the rail.
- `aria-label` (`string`, required): The rail's accessible name.
- `orientation` (`"column" | "row"`, default `"column"`): `column`: down the menu's inline-start edge, beside the rows; `row`: across its top, for `MenuContent tabs`.
- `lead` (`ReactNode`): A control before the tabs, in a row rail: a Tab stop of its own.
- `foot` (`ReactNode`): One control at the rail's foot (an `IconButton`): a Tab stop after the tabs.
- `children` (`ReactNode`): `MenuRailTab`s, in order.

### MenuRailTab

- `value` (`string`, required): This section's value.
- `label` (`string`, required): Its name: the tooltip and the accessible name.
- `icon` (`IconName | ReactElement`, required): A registry glyph or a mark element, at 16px.
- `light` (`boolean`, default `false`): A red light on the mark's corner: the section can't serve now (its allowance spent).

### MenuHead

- `title` (`ReactNode`): What the rows are (a section's name), text-2. None: the line holds its detail alone.
- `detail` (`ReactNode`): One fact said once for every row, text-3; it gives way first.
- `option` (`ReactNode`): One `MenuOption` at the line's end: a Tab stop after the rail.

### MenuOption

- `icon` (`IconName`, default `"chevron-right"`): The chip's glyph after its label; default `chevron-right` (`more` for an account's choices).
- `label` (`ReactNode`, required): What the chip says: the option's value now ("High", "Auto"). Empty: the glyph alone, which on a head is a ghost.
- `aria-label` (`string`, required): The chip's accessible name, and its menu's.
- `open` (`boolean`): Controlled open state of its menu.
- `defaultOpen` (`boolean`)
- `onOpenChange` (`(open: boolean, details: OpenChangeDetails) => void`)
- `onStep` (`(direction: 1 | -1) => boolean | void`): On a row: ←→ from any row of the menu step the option's level. Without it, → on its row opens the option.
- `width` (`number`): Its menu's width in pixels.
- `onKeyDown` (`(e: KeyboardEvent<HTMLDivElement>) => void`): Its menu's keys, before the menu's own.
- `initialFocus` (`FocusTarget`): The first control to focus, if it is not a menu row.
- `drill` (`"padded" | "flush"`, default `"padded"`): How its menu stands where it has no room beside the whole menu and drills in place instead (a menu 390 wide): `padded`, the menu pad above its rows, the default, or `flush`, the rows under the back rule and a group label on the section line. With room beside the menu it opens as a popover either way.
- `children` (`ReactNode`): Its menu's rows and controls.

### MenuSwatchRow

- `label` (`string`, required): Visible row label and the group's accessible name.
- `choices` (`readonly MenuSwatchChoice<T>[]`, required): The colour choices in display order.
- `value` (`T`, required): The currently chosen value (controlled).
- `onChange` (`(value: T) => void`, required): Called with the picked choice's value.
- `closeOnClick` (`boolean`, default `true`): Close the menu when a swatch is picked.
- `disabled` (`boolean`, default `false`): Disables every swatch in the row.
- `rootStyle` (`RootStyle`): Typed StyleX override: layout.

Rest props go to `<div>` props.
