21st

Model Picker

AI chats 9

About

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.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Model Picker to your project and fits it to your theme.

Code

How Model Picker is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

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>
  );
}

Dependencies

More by 21st

View all
  • Spline Scene

    Spline Scene

    9.5K
  • Testimonials with Marquee

    Testimonials with Marquee

    2.3K
  • Gradient Button

    Gradient Button

    1.9K
  • Pixel Canvas

    Pixel Canvas

    902
  • Animated Blur Number

    Animated Blur Number

    831
  • Empty State

    Empty State

    775
  • Balloons

    Balloons

    756
  • Status Badge

    Status Badge

    648

More in AI chats

View all
  • AI Actions

    AI Actions

    320
  • System Message

    System Message

    55
  • AI Task List

    AI Task List

    161
  • Message Thread

    Message Thread

    38
  • Chat Bubble

    Chat Bubble

    184
  • Color Picker

    Color Picker

    88
  • Code Block

    Code Block

    8
  • Message With Header And Delivery Status

    Message With Header And Delivery Status

    38