# Model picker

A model picker for a composer: the companies across the top, the search, the account, the models, and the band that sets how they run.

Live variants: https://design.arcadia.is/components/model-picker

```tsx
import { ModelPicker } from "@arcadia/ui";
```

Open the picker to change the model, effort, or Fast mode.

Compare a filtered list with an unavailable model.

## Usage

```tsx
import { Menu, MenuTrigger, ModelPicker, ModelChip } from "@arcadia/ui";

<Menu>
  <MenuTrigger render={<ModelChip provider="openai" label={model.label} />} />
  <ModelPicker
    providers={providers}
    activeProvider={provider}
    onActiveProviderChange={setProvider}
    models={models}
    selected={model.id}
    onSelectedChange={(id) => setModel(findModel(id))}
    effort={{ levels: ["Low", "Normal", "High"], value: effort, onChange: setEffort }}
    fast={{ value: fast, onChange: setFast }}
    search={{ value: query, onChange: setQuery }}
  />
</Menu>
```

## Accessibility

The surface is a menu: the companies are a horizontal `tablist`, the search a combobox over the rows, and each model a `menuitemradio`, the chosen one filled and saying its threshold at its end. The effort band slider is named by its label and says each level in words.

- Tab: The search, the companies, the account, the rows, then the band
- Arrow keys: Along the companies; through the rows; along the slider
- Esc: Empties the query, then closes the menu

## API reference

### ModelPicker

- `providers` (`readonly ModelPickerProvider[]`, required): The companies across the top, in order.
- `activeProvider` (`string`, required): The chosen company's value.
- `onActiveProviderChange` (`(id: string) => void`)
- `account` (`{ label: ReactNode; action?: ReactNode }`): Whose account the chosen company's models run on, and the action at the line's end.
- `models` (`readonly ModelPickerModel[]`, required): The chosen company's models, in order.
- `selected` (`string`, required): The chosen model's id.
- `onSelectedChange` (`(id: string) => void`)
- `effort` (`ModelPickerEffort`): The band under the list, for a model that runs at levels.
- `fast` (`ModelPickerFast`): The switch under the band.
- `search` (`ModelPickerSearch`): The search row, above the rows and never scrolled.
- `settingsAction` (`ReactNode`): The rail's foot: "Choose models", "Connect more providers".
- `empty` (`ReactNode`, default `"No matches"`): What the list says when it holds no row. false says nothing.
- `rows` (`ReactNode`): Rows of the product's own in the models' place: an action per model rather than one choice.
- `before` (`ReactNode`): Rows above the models in the scrolled list: the chat's own model when its company's list leaves it out.
- `after` (`ReactNode`): Rows under the models in the scrolled list: the model's own settings, a way to set a company up.
- `stayOpen` (`boolean`): A pick leaves the picker open: the band under the list takes the new model's effort in place.
- `reselect` (`boolean`): Picking the chosen model again calls onSelectedChange: a choice that is also an order.
- `keys` (`boolean`, default `false`): The band names its keys under the effort: the arrows for the level, Enter for done, Esc for back.
- `onDone` (`() => void`): The person is done: Enter in the band, or a pick while the picker closes on one (`stayOpen` off). Where a product closes its popover, the pick having already called onSelectedChange.
- `width` (`MenuContentProps["width"]`, default `344`): The surface's width: pixels, or "auto" to fit its rows.
- `aria-label` (`string`, default `"Models"`): The menu's name where its trigger doesn't give one.
- `container` (`PortalContainer`, default `the page body`): Where it mounts: a themed subtree, or a stage that shows it open in place.
- `side` (`"top" | "bottom" | "left" | "right" | "inline-start" | "inline-end"`, default `"bottom"`): The side it opens on, from its trigger. A composer opens it above the field.
- `align` (`"start" | "center" | "end"`, default `"start"`): Its alignment against the trigger.

Rest props go to `Pick<MenuContentProps, "sideOffset" | "finalFocus" | "morph" | "instant" | "inline">`.

### ModelPickerModel

- `id` (`string`, required)
- `label` (`string`, required): The model's name.
- `disabled` (`boolean`): It cannot be picked now: the row is drawn at text-4 and skipped.
- `option` (`ReactNode`): A control in the chosen row's check's place: a MenuOption that opens the model's own choices. Picking the chosen row opens it.
- `end` (`ReactNode`): What stands at the row's end: a chip, a fact ("API", "Back in 2h"), the threshold the chat compacts at.
- `description` (`ReactNode`): Words after the name: whose model it is when a search mixes companies.
- `why` (`string`): Why it cannot be picked here or is not in the person's list: the row's tooltip, and its description when disabled.
- `whyHidden` (`boolean`): The tooltip stays mounted but unshown, as while the row's option is open.

### ModelPickerProvider

- `id` (`string`, required): Its value on the rail.
- `label` (`string`, required): Its name: the tab's tooltip and its accessible name.
- `mark` (`"openai" | "xiaomi" | "zai" | "opencode" | "grok" | "deepseek" | "google" | "anthropic" | "claude" | "mistral" | "commandcode" | "cursor" | "gmail" | "github"`): Its mark, or none for the rail's own model glyph.
- `light` (`boolean`): Its allowance is spent: a light on the tab's corner.
