Model Selector
Let people pick the model that answers, from a searchable list grouped by provider.
Use a model selector in a prompt's toolbar when people can choose which model answers. The field shows the chosen model and its provider in one compact row, and typing in it filters the list, best match first, with the matching letters marked. Place Reasoning Effort beside it when the model can think harder.
Installation
npx shadcn@latest add @kind-ui/model-selectorComposition
ModelSelector
├── ModelSelectorTrigger
│ ├── ModelSelectorIcon
│ └── ModelSelectorInput
└── ModelSelectorContent
├── ModelSelectorEmpty
└── ModelSelectorGroup
└── ModelSelectorItemModelSelector is a group named by its label that holds UI SDK's Combobox. ModelSelectorTrigger is the field: the chosen model's icon (ModelSelectorIcon), the search field, the chosen model's group and a button that opens the list. ModelSelectorInput is the search field, which shows the chosen model's name while the list is closed. ModelSelectorContent is the list, with a ModelSelectorGroup for each provider, a ModelSelectorItem for each model and ModelSelectorEmpty while nothing matches.
Usage
Models
Pass models, each with an id and a name, and optionally a group, a description, an icon and disabled. The list shows the groups in the order they first appear, and each model with its description under its name. A disabled model stays in the list, dimmed, and can't be chosen by pointer, keyboard or setValue.
<ModelSelector
models={[
{ id: "gpt-6.1-sol", name: "GPT-6.1 Sol", group: "OpenAI", icon: "/logos/openai.svg" },
{ id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "Anthropic", description: "Balanced" },
]}
defaultValue="claude-sonnet-5.5"
onValueChange={(id) => setModel(id)}
/>Pass value and onValueChange to control the chosen model, or defaultValue to start with one. onValueChange gets the model's id, with the reason input-change when a person chose it, or imperative from setValue.
Icons
Give a model an icon to show it before the name, in its list row and, once it's chosen, in the field before the search text. In React, icon is an image URL or an element, like an inline <svg>:
const models = [
{ id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", group: "Anthropic", icon: <AnthropicLogo /> },
{ id: "grok-4.7", name: "Grok 4.7", group: "xAI", icon: "/logos/xai.svg" },
];Icons render at 16px. A monochrome SVG drawn with currentColor takes the text color, so it reads in light and dark. Icons are decorative and hidden from assistive technology, so the model's name stays its label. Rows keep one height and their names line up, whether or not a model has an icon. The package ships no logos; you pass your own.
Searching
Typing in the field filters the list as you type. A model matches when its name, group or description holds the letters in order, so "son55" finds Claude Sonnet 5.5. Within each group, the best match comes first, and a group with no match is hidden. The letters that matched the name are marked. When nothing matches, the list says "No models found.".
The field keeps its width whatever the model's name, so choosing a longer one moves nothing beside it; a long name is cut short with an ellipsis. Set --kind-model-selector-width to change the width.
Keyboard
The field is one Tab stop. Typing or Down Arrow opens the list. While you type, the best match is highlighted, so Enter chooses it; the arrow keys move the highlight, skipping disabled models. Escape closes the list and puts the chosen model's name back, with focus still in the field.
Motion
The list rises and fades in below the field. Under prefers-reduced-motion, or with motion="reduced", it only fades, over 120 ms, and with motion="none" it opens at once.
API Reference
Prop
Type
Agent
An agent connected with createAgent finds the model selector by its label and reads the chosen model's id. Its setValue takes a model's id or its name, the same as a person choosing it, and refuses a model that isn't listed. A disabled model returns false and changes nothing. It needs no person to confirm.
Prop
Type
Runs in React and Web Components. On <kind-model-selector>, set models and value as properties, and listen for modelchange, with the model's id as event.detail.value. A model's icon is an image URL or an Element, which the element clones into each row. The element fills in its field and list when it has no children.