Model Picker
Choose the model a chat is sent to, from aComposer's toolbar. A compact pill<button> opens a role="listbox" in a native popover, with provider groups, descriptions, badges, logos, disabled options and typeahead.
Messages go to Atlas Swift.
Playground
Toggle every adjustable prop and watch the component — and the code — update live.
Same component — Kernel look stripped. See Platforms.
Usage
<Composer
actionsLeading={
<ModelPicker
options={[
{ value: "atlas", label: "Atlas", description: "Deepest reasoning, longest context", group: "Northwind", badges: [{ label: "New", variant: "accent" }], icon: <SparkIcon /> },
// …
]}
defaultValue="atlas"
placement="bottom"
onValueChange={setModel}
/>
}
/><kernel-model-picker value="atlas" placement="bottom">
<optgroup label="Northwind">
<option value="atlas" data-description="Deepest reasoning, longest context" data-badges="New:accent">Atlas</option>
</optgroup>
</kernel-model-picker>
<script type="module">
document.querySelector("kernel-model-picker")
.addEventListener("valuechange", (event) => console.log(event.detail.value));
</script>Props
| Prop | Type | Default | Notes |
|---|---|---|---|
options | ModelPickerOption[] | Required | — |
value | string | — | — |
defaultValue | string | — | — |
onValueChange | (value: string) => void | — | — |
name | string | — | Submits the value with a surrounding form, through a hidden input. |
disabled | boolean | false | — |
placement | FloatingPlacement | "top" | Which side of the trigger the list opens on. Defaults to "top", since a composer sits at the bottom of the screen; it flips when there's no room. |
align | FloatingAlign | "start" | Cross-axis alignment. Defaults to "start". |
offset | number | 8 | Gap between trigger and list, in pixels. Defaults to 8. |
id | string | — | — |
className | ClassNameValue<ModelPickerState> | — | Classes for the trigger button. |
listClassName | ClassNameValue<ModelPickerState> | — | Classes for the popup list. |
labels | Partial<ModelPickerLabels> | — | Override built-in strings (e.g. for translation); unset keys keep their English default. |
Web Components
| Tag | Attributes | Events |
|---|---|---|
<kernel-model-picker> | value, name, disabled, label-model, label-placeholder | valuechange |
Each option is { value, label, description?, group?, badges?, icon?, disabled? }. Consecutive options with the same group are listed under one heading. A badge is a string (a neutral Badge) or { label, variant }.
Why not Select?
A native <select> is the right answer for plain options, and Select is one. A model list isn't plain: each option carries a description, badges and a logo, and <option> can only hold text outside Chromium'sappearance: base-select. So the picker keeps what the platform does give — the popover's top layer, light dismiss, Escape and focus return to the trigger — and adds the WAI-ARIA listbox pattern by hand.
In a composer
The trigger is sized to --kernel-control-height-sm, level with a small send button, and drawn with Kernel's optical pill recipe: the radius stops at a true half-height pill, the text clears the end caps, and the logo and chevron sit concentric with them at every radius setting. It opens upward by default, since a composer sits at the bottom of the screen, and flips when there's no room.
<Composer
actionsLeading={<ModelPicker options={models} value={model} onValueChange={setModel} />}
actionsTrailing={({ submit }) => <Button size="sm" variant="primary" onClick={submit}>Send</Button>}
/>In the elements package, options come from the optionsproperty, or from light-DOM <option>s (optionally in<optgroup label>) with data-descriptionand data-badges="New:accent, Fast". It firesvaluechange with detail.value.
Keyboard
- Enter, Space, ↓ or ↑ on the trigger opens the list on the current model.
- ↓/↑ move through enabled options; Home/End jump to the ends.
- Enter or Space selects and returns focus to the trigger; Escape closes without changing it; Tab closes and moves on.
- Typing jumps to a model by name — on the open list or the closed trigger. Repeating one letter cycles through the models that start with it.
Accessibility
- The trigger reads "Model, Atlas Swift" — the model name, with a visually hidden prefix (
labels.model) saying what it is. - Focus moves to the list and
aria-activedescendanttracks the active option, so a screen reader announces each option as you arrow. - Groups are
role="group"labelled by their heading, so crossing into a provider announces it. - Disabled options stay listed and announced as unavailable (
aria-disabled), and are skipped by the arrows and typeahead. - Logos are decorative; the name already says which model it is.