AI Model Picker
A model dropdown picker with capability star ratings, speed / cost badges, and a recommended tag.
A model-switching dropdown for AI applications: every option lists a provider color swatch, an intelligence star rating, a speed lightning bolt, and a cost $ badge, and can be tagged "Recommended". The selected item gets a check mark, the panel opens and closes on a spring, and full keyboard operation is supported.
Bring this into your project
Run this command in your project folder. The CLI adds the source and dependencies; then follow the usage example below.
npx webberui@latest add ai-model-picker.enPlayground
Tune the props live — the code snippet updates as you go, so you can dial in the look you want before copying it.
<AiModelPicker/>
The complete example includes the preview layout and data. Install the component first, then paste this file into your project.
Installation
npx webberui@latest add https://webberui.com/r/ai-model-picker.en.jsonOr, once registries are configured in components.json, install it as @webberui/ai-model-picker.
Usage
import { AiModelPicker, type AiModel } from "@/components/ui/ai-model-picker";
const models: AiModel[] = [
{
id: "aurora-pro",
name: "Aurora Pro",
provider: "Auralab",
intelligence: 4,
speed: 2,
cost: 2,
recommended: true,
description: "The best balance of intelligence and speed",
},
{
id: "swift-mini",
name: "Swift Mini",
provider: "Swiftware",
intelligence: 3,
speed: 3,
cost: 1,
},
];
<AiModelPicker
models={models}
defaultValue="aurora-pro"
onChange={(model) => console.log(model.id)}
/>Preview card and reasoning settings
With preview on, hovering or arrow-key highlighting an option shows a preview card on the right of the panel: four metrics (intelligence, speed, context, cost) plus two radio groups, reasoning effort (low / medium / high) and speed mode (standard / fast). Changing a setting shifts the metrics live, with a faint track marking the raw value so the direction of the shift is easy to read; settings that differ from the defaults (medium, standard) show up as badges on the trigger. scrollFade adds a fade mask at the bottom while the list can still scroll.
const [options, setOptions] = React.useState<AiModelOptions>({
effort: "medium",
speed: "standard",
});
<AiModelPicker
models={models}
defaultValue="aurora-pro"
preview
scrollFade
options={options}
onOptionsChange={setOptions}
/>context (1–5) and contextLabel are optional AiModel fields used only by the preview card's "Context" metric; context counts as 3 when omitted. Both new features are off by default, so without them the panel looks and behaves exactly as before.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
models | AiModel[] | — | List of selectable models |
value | string | — | Controlled mode: id of the currently selected model |
defaultValue | string | — | Uncontrolled mode: id of the model selected by default |
onChange | (model: AiModel) => void | — | Callback when the selection changes, passing the complete model object |
placeholder | string | "Choose a model" ("Select a model") | Text shown on the trigger when no model has been selected yet |
maxHeight | number | 280 | Maximum height of the dropdown panel (px); the panel scrolls internally beyond that |
preview | boolean | false | Shows a preview card (four metrics plus settings) on the right of the panel for the hovered or keyboard-highlighted item |
options | AiModelOptions | — | Controlled mode: reasoning effort and speed mode settings |
defaultOptions | AiModelOptions | { effort: "medium", speed: "standard" } | Uncontrolled mode: initial settings |
onOptionsChange | (options: AiModelOptions) => void | — | Callback when settings change inside the preview card |
scrollFade | boolean | false | Shows a fade mask at the bottom while the list can still scroll |
className | string | — | Forwarded to the outermost container, merged through cn() |
AiModel
| Field | Type | Default | Description |
|---|---|---|---|
id | string | — | Unique identifier, used as the selection value |
name | string | — | Display name of the model |
provider | string | — | Provider name, shown beneath the name and used for the color swatch |
hue | number | Derived from provider | Hue of the provider color swatch (0–360) |
intelligence | number | — | Intelligence star rating (1–5, shown as stars) |
speed | number | — | Speed level (1–3, shown as lightning bolts) |
cost | number | — | Cost level (1–3, shown as $) |
description | string | — | A one-line short description, shown in the option row |
recommended | boolean | false | Whether the "Recommended" tag is shown |
context | number | 3 | Context length level (1–5), used by the preview card's "Context" metric |
contextLabel | string | — | Display text for the context length (e.g. "128K"), shown next to the metric |
AiModelOptions
| Field | Type | Default | Description |
|---|---|---|---|
effort | "low" | "medium" | "high" | "medium" | Reasoning effort: low raises speed and lowers cost and intelligence; high does the opposite |
speed | "standard" | "fast" | "standard" | Speed mode: fast raises speed and cost |
Accessibility
- The trigger is marked
aria-haspopup="listbox"witharia-expanded, and the panel isrole="listbox"; focus moves into the panel on open, and focus returns to the trigger on close - Full keyboard support: ↑/↓ opens and moves the highlight, Home/End jumps to the first and last, Enter/Space selects, Esc closes, and Tab collapses and leaves
aria-activedescendantpoints at the currently highlighted option and the selected item is markedaria-selected, so assistive technology announces it correctly- The star ratings and badges are announced through
role="img"with text labels such as "Intelligence 4/5", while the individual icons are hidden from assistive technology (aria-hidden) - The preview card is a labelled
aside; the four metrics are announced viarole="meter"witharia-valuenow, and reasoning effort and speed mode arerole="radiogroup"controls where arrow keys switch and apply immediately - With
previewon, Tab moves from the list into the preview card settings, and the panel collapses only once focus leaves the whole component; Esc inside the preview card also closes it and returns focus to the trigger - When the user has "reduce motion" enabled at the system level, the panel degrades to a plain fade in / fade out, the arrow and check mark drop their pop animations, and the metric bars jump straight to their new values