Model Picker

A model switcher for AI chat inputs that unfolds out of its own pill into a searchable list.

Dependencies

motionlucide-react

Interaction Type

Click the pill and the list unfolds around it, with the current model staying exactly where the pill was. Hover or use the arrow keys and a soft highlight slides along, while the footer shows what that model is good at. Type to filter. Pick one and the list folds away around it, carrying that row down into the pill. Escape or a click outside folds it back onto the current model.

Props

Options you can pass to customize this component.

Prop
Type
Description
models*
PickerModel[]

The models to list, in order. Each has an id and name, plus an optional provider to group by, icon, description, and speed and intelligence from 1 to 5.

value
string

The selected model id, for controlled use.

defaultValue
string

The model selected on first render. Defaults to the first model.

onChange
(id: string) => void

Called with the new id when a different model is picked.

searchable
boolean

Shows a search field at the top of the list.

className
string

Extra classes merged onto the root element (data-slot="model-picker").

Installation

npx shadcn@latest add swamimalode07/rare-ui/model-picker

How to use

"use client"
import { useState } from "react"
import { ModelPicker, type PickerModel } from "@/components/ui/model-picker"
const models: PickerModel[] = [
{ id: "opus", name: "Claude Opus 5.5", provider: "Anthropic", description: "Most capable", speed: 2, intelligence: 5 },
{ id: "sonnet", name: "Claude Sonnet 5.5", provider: "Anthropic", description: "Smart and quick", speed: 4, intelligence: 4 },
{ id: "haiku", name: "Claude Haiku 5.5", provider: "Anthropic", description: "Fastest", speed: 5, intelligence: 3 },
]
export function Toolbar() {
const [model, setModel] = useState("opus")
return <ModelPicker models={models} value={model} onChange={setModel} />
}

Source Code

Click the code icon in the top-right corner to view the source code.

Keep in mind

Most components here are recreations of great work from around the web. I don't claim to be the original creator - this is my attempt to reverse-engineer, replicate, and often add a few extra features. I've tried to credit everyone; if I missed someone, let me know.

Contact

Found a bug or issue? Feel free to drop a DM.

License & Usage

  • •MIT with the Commons Clause and an attribution requirement. Free to use, modify and ship in personal and commercial projects, closed source included. You own the code once it is in your project.
  • •Credit is required. Any project shipping a Rare UI component must credit Rare UI with a visible link back to rareui.com, in a footer, an about page, a credits screen or a README.
  • •Don't strip the credit or the copyright notice from the source you copied.
  • •Don't sell, sublicense or redistribute the components themselves, on their own, bundled into a template, kit, theme or paid course, or ported to another framework.
  • •Don't republish them. No mirrors, no re-uploads, no listing them as your own work.
  • •Don't repackage the registry as a competing component library.
  • •Don't claim authorship of a component or of Rare UI itself.
  • •The LICENSE file in the repository is the full text and governs. Ask first if your use doesn't fit these rules.
Model Picker

Ask anything