Model Picker
A listbox of models, Recommended first. Point at one and a tray fills with speed, quality and cost bars, time to the first word and the price of the next reply. A thinking switch unfolds Low, Medium and High, and the estimate rolls with it. Past eight models a search box appears.
The decision inside it
Price for this conversation, not per million tokens
"$3 / M input" means nothing to the person choosing. Pass the size of the chat and the tray says "≈ $0.04 for the next reply". A model whose context window cannot hold the chat is disabled and says so in numbers.
When to use it
Use Model Picker in a chat composer or agent settings to choose a model with its speed, quality and the cost of the next reply for this conversation. Pass contextTokens so models that cannot hold the chat are disabled.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Layro's Model Picker for this.
Install it: npx shadcn@latest add @layro/model-picker
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/model-picker.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.
Usage
"use client";
import * as React from "react";
import { ModelPicker, type ModelOption } from "@/components/ui/model-picker";
const models: ModelOption[] = [
{ id: "swift", name: "Swift", provider: "Madgixs AI", speed: 5, quality: 3, inputPrice: 0.8, outputPrice: 4, contextWindow: 200_000, firstTokenMs: 300, recommended: true },
{ id: "deep", name: "Deep", provider: "Madgixs AI", speed: 2, quality: 5, inputPrice: 15, outputPrice: 75, contextWindow: 200_000, firstTokenMs: 1200, thinking: true },
];
export function ChatModel({ tokens }: { tokens: number }) {
const [model, setModel] = React.useState("swift");
return <ModelPicker models={models} value={model} onChange={setModel} contextTokens={tokens} side="top" />;
}API reference
“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Prop | Type | Notes |
|---|---|---|
modelsrequired | ModelOption[] | — |
value | string | The chosen model id. Leave out to let the picker keep its own. |
defaultValue | string | — |
onChange | (id: string) => void | — |
thinking | ThinkingState | Controlled thinking. |
defaultThinking | ThinkingState | — |
onThinkingChange | (t: ThinkingState) => void | — |
contextTokens | number | Tokens in the conversation so far. Drives the estimate and which models fit. |
expectedOutputTokens | number | Tokens a typical reply runs to. Default 800. |
thinkingBudget | Record<Effort, number> | Extra output tokens per effort level. Default 1k / 4k / 16k. |
open | boolean | Controlled open state. |
defaultOpen | boolean | — |
onOpenChange | (open: boolean) => void | — |
side | "top" | "bottom" | Where the menu opens. Default `bottom`. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLayro foundations, installed alongside it
layro-themeStates
All of them are drawn by the component. None is left for you to design.
- Closed
- Open
- Thinking on
- Too small for this chat
- Searching
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances
Used in a screenAll screens
Lifetime access
Every component, and everything we ship next.
- All 232 components, source included
- Every template, and everything released after you buy
- shadcn CLI or download — React 18/19, Tailwind v4
- One payment. No subscription.