Loading component…
Loading component…
The model menu of an AI chat – point at a model and its speed, quality and cost bars fill, switch on extended thinking and its effort unfolds, with first-token time and price
To reuse this local React demo, copy all files from the Code tab into the same folder, then import ModelPicker from ./model-picker.
import { ModelPicker } from "@/components/ui/model-picker";
const models = [
{ id: "opus", name: "Opus 5.5", description: "Hardest problems", speed: 2, quality: 5, cost: 5, latencyMs: 2100, pricePerM: 25 },
{ id: "sonnet", name: "Sonnet 5.5", description: "Everyday work", speed: 4, quality: 4, cost: 3, latencyMs: 900, pricePerM: 15 },
{ id: "haiku", name: "Haiku 5.5", description: "Quick and light", speed: 5, quality: 3, cost: 1, latencyMs: 400, pricePerM: 4 },
];
export function ComposerToolbar() {
return (
<div className="toolbar">
<ModelPicker models={models} defaultValue="sonnet" />
<SendButton />
</div>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| models | PickerModel[] | { id, name, description?, icon?, speed?, quality?, cost?, latencyMs?, pricePerM? } – strengths go from 1 to 5 (cost 5 is the most expensive); leave all three out for a router like Auto and the row says "Varies" | |
| value | string | Id of the chosen model (controlled) | |
| defaultValue | string | first model | Chosen model when uncontrolled |
| onChange | (id: string) => void | Called with the picked model's id | |
| thinking | boolean | Extended thinking switch (controlled) | |
| defaultThinking | boolean | false | Starting state of the thinking switch |
| onThinkingChange | (on: boolean) => void | Called when the thinking switch flips | |
| webSearch | boolean | Web search switch (controlled) | |
| defaultWebSearch | boolean | false | Starting state of the web search switch |
| onWebSearchChange | (on: boolean) => void | Called when the web search switch flips | |
| effort | "low" \| "medium" \| "high" | Thinking effort (controlled) – the control only shows while thinking is on | |
| defaultEffort | "low" \| "medium" \| "high" | "medium" | Starting effort |
| onEffortChange | (effort) => void | Called with the new effort | |
| open | boolean | Controlled open state of the menu | |
| defaultOpen | boolean | false | Starts open when uncontrolled |
| onOpenChange | (open: boolean) => void | Called when the menu opens or closes | |
| align | "start" \| "end" | "start" | Which edge of the trigger the menu lines up with |
| side | "bottom" \| "top" | "bottom" | Opens below or above the trigger – use top for a composer at the bottom of the screen |
| className | string | Extra class on the root |
The menu is 320px wide and never wider than the screen minus 32px. Below 300px the row glyphs and key hints give way and the bars move closer
Touch screens: taller trigger, rows, switches and effort buttons; the key hints are hidden
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"