# Picker trigger

The text trigger with a chevron that pickers use: repo, branch, model, environment.

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

```tsx
import { PickerTrigger, ModelChip } from "@arcadia/ui";
```

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

function Pickers() {
  const [project, setProject] = useState("acme-web");
  const [branch, setBranch] = useState("main");
  const [model, setModel] = useState("Aster");
  const pickers = [
    { name: "Project", value: project, setValue: setProject, choices: ["acme-web", "design"], appearance: { icon: "folder", variant: "secondary" } },
    { name: "Branch", value: branch, setValue: setBranch, choices: ["main", "preview"], appearance: { icon: "branch", tone: "muted" } },
    { name: "Model", value: model, setValue: setModel, choices: ["Aster", "Rowan"], appearance: { sub: "High effort" } },
  ] as const;

  return pickers.map(({ name, value, setValue, choices, appearance }) => (
    <Menu key={name}>
      <MenuTrigger render={<PickerTrigger label={value} aria-label={name + ": " + value} {...appearance} weight="bold" />} />
      <MenuContent aria-label={name}>
        <MenuRadioGroup value={value} onValueChange={setValue}>
          {choices.map((choice) => <MenuRadioItem key={choice} value={choice}>{choice}</MenuRadioItem>)}
        </MenuRadioGroup>
      </MenuContent>
    </Menu>
  ));
}
```

## Accessibility

A `<button>`. As a `MenuTrigger` it gets `aria-haspopup` and `aria-expanded`, and focus moves into the menu and back. The icon and the chevron are decorative, so the accessible name is the visible value alone. Its height is a least height, so a person's own text spacing grows it instead of clipping the value.

A value without its context reads poorly ("main, button"), so name what is being picked: `aria-label="Branch: main"`, as in the example above. Keep the visible label in that name, so voice control can still find it by what it shows.

- Enter + Space: Open the picker's menu
- Esc: Close it and return focus

## API reference

### PickerTrigger

- `label` (`string`, required)
- `forms` (`readonly string[]`)
- `last` (`boolean`)
- `tooltip` (`false`)
- `onShortChange` (`(short: boolean) => void`)
- `icon` (`IconName | ReactElement`)
- `sub` (`string`)
- `tail` (`ReactElement`)
- `emphasis` (`boolean`)
- `variant` (`"ghost" | "secondary"`)
- `tone` (`"neutral" | "muted"`)
- `weight` (`"regular" | "bold"`)
- `size` (`"sm" | "md"`)
- `width` (`number`)
- `chevron` (`IconName | false`)
- `flush` (`boolean`)
- `ellipsisLabel` (`boolean`)
- `rootStyle` (`PickerTriggerStyle`)
- `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.

### ModelChip

- `provider` (`"openai" | "xiaomi" | "zai" | "opencode" | "grok" | "deepseek" | "google" | "anthropic" | "claude" | "mistral" | "commandcode" | "cursor" | "gmail" | "github"`)
- `label` (`string`, required)
- `forms` (`readonly string[]`)
- `last` (`boolean`)
- `tooltip` (`false`)
- `onShortChange` (`(short: boolean) => void`)
- `sub` (`string`)
- `tail` (`ReactElement`)
- `emphasis` (`boolean`)
- `variant` (`"ghost" | "secondary"`)
- `tone` (`"neutral" | "muted"`)
- `weight` (`"regular" | "bold"`)
- `size` (`"sm" | "md"`)
- `width` (`number`)
- `chevron` (`IconName | false`)
- `flush` (`boolean`)
- `ellipsisLabel` (`boolean`)
- `rootStyle` (`PickerTriggerStyle`)
- `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.
