Ballmac UI home

Model Picker

A searchable model selector grouped by provider, with capability icons, locked plans and a detail pane that follows the highlighted model with context window, cost and abilities.

Installation

$ pnpm dlx shadcn@latest add @ballmac/model-picker

Usage

import { ModelPicker, formatContext } from "@/components/ballmac/model-picker"

The full example is in the Code tab above.

Examples

Compact in a composer

API reference

PropTypeDefault
models*

The models to offer. Models that share a `provider` are grouped.

ModelOption[]—
value

Selected model id (controlled).

string—
defaultValue

Initial model id when uncontrolled.

string—
onValueChange

Called with the chosen id.

(id: string) => void—
placeholder

Shown on the trigger when nothing is selected.

string—
searchPlaceholder

Placeholder of the search box.

string—
searchable

Show the search box. Defaults to on when there are more than six models.

boolean—
showDetails

Show the detail pane that follows the highlighted model on wider screens.

booleantrue
onLockedSelect

Called when a locked model is chosen, for example to open an upgrade dialog.

(model: ModelOption) => void—
align

Which side of the trigger the list aligns to.

"start" | "center" | "end""start"
variant

Trigger style. "compact" hides the provider mark and is sized for a composer toolbar.

"default" | "compact""default"

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Enter / Space / ArrowDownOpens the list from the trigger
ArrowUp / ArrowDownMoves the highlight; the detail pane updates
EnterSelects the model and returns focus to the trigger
EscapeCloses without changing

Use with AI

models is an array of { id, name, provider?, description?, capabilities?, contextWindow?, cost?, isNew?, locked? }. value/onValueChange or defaultValue. Locked models call onLockedSelect. variant default | compact. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Model Picker (@ballmac/model-picker) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Choosing the model for a chat or an agent
  • Any picker where options have facts worth comparing

Not for

  • A plain short list of choices; use select
  • Settings with many fields; use settings-panel

Registry JSON: https://ui.ballmac.com/r/model-picker.json

Credits

Free to use in personal and commercial projects.