Components
Standalone model picker pill button with built-in popover. Renders model name + version split (e.g. Sonnet 4.6). Supports controlled and uncontrolled modes. Self-contained port from 21st.dev Agent Elements.
npx shadcn@latest add https://21st.dev/r/21stdev/model-pickerLoading preview...
import { ModelPicker, type ModelOption } from "@/components/ui/model-picker";
import { IconArrowUp } from "@tabler/icons-react";
const models: ModelOption[] = [
{ id: "sonnet-4-6", name: "Sonnet", version: "4.6" },
{ id: "opus-4-7", name: "Opus", version: "4.7" },
{ id: "haiku-4-5", name: "Haiku", version: "4.5" },
];
export default function Demo() {
return (
<div className="flex items-center justify-center w-full min-h-screen bg-background p-8 overflow-hidden">
<div className="w-full max-w-md">
<div className="rounded-3xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-950 p-3 shadow-sm">
<input
type="text"
placeholder="Send a message…"
className="w-full bg-transparent px-2 py-1.5 text-sm text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 outline-none"
/>
<div className="flex items-center justify-between mt-1">
<ModelPicker models={models} defaultValue="sonnet-4-6" />
<button
type="button"
aria-label="Send message"
className="flex items-center justify-center size-7 rounded-full bg-neutral-300 dark:bg-neutral-700 text-neutral-600 dark:text-neutral-300 transition-colors hover:bg-neutral-400 dark:hover:bg-neutral-600"
>
<IconArrowUp className="size-4" />
</button>
</div>
</div>
</div>
</div>
);
}
Loading preview...