A composer pill that switches models from a grouped list, with a reasoning-effort toggle for models that think.
Set your access key from API keys as NEXTUI_TOKEN in .env.local and add the @nextui namespace below to components.json once. Then every item installs by name. Each install counts as a copy on a free account.
$pnpm dlx shadcn@latest add @nextui/model-picker
1{2"registries": {3"@nextui": {4"url": "https://nextui.dev/r/{name}.json",5"headers": { "Authorization": "Bearer ${NEXTUI_TOKEN}" }6}7}8}
1"use client";23import { useState } from "react";4import { useChat } from "@ai-sdk/react";5import { ModelPicker, type ReasoningEffort } from "@/components/nextui/model-picker";67export function Composer() {8const { sendMessage } = useChat();9const [model, setModel] = useState("anthropic/claude-sonnet-5.5");10const [effort, setEffort] = useState<ReasoningEffort>("medium");1112return (13<form14onSubmit={(e) => {15e.preventDefault();16const text = new FormData(e.currentTarget).get("text") as string;17// Send the choice with each message; read it in your route handler.18sendMessage({ text }, { body: { model, effort } });19}}20>21<textarea name="text" />22<ModelPicker value={model} onValueChange={setModel} effort={effort} onEffortChange={setEffort} />23</form>24);25}
| Prop | Type | Default | Description |
|---|---|---|---|
| models | ModelOption[] | – | Models to list: id, name, provider, description, tags, reasoning. Grouped by provider in the order given |
| value | string | – | Controlled model id |
| defaultValue | string | – | Starting model id when uncontrolled; defaults to the second model |
| onValueChange | (id: string) => void | – | Called when a model is picked |
| effort | "low" | "medium" | "high" | – | Controlled reasoning effort; the toggle shows only for models with reasoning |
| defaultEffort | "low" | "medium" | "high" | "medium" | Starting effort when uncontrolled |
| onEffortChange | (effort: ReasoningEffort) => void | – | Called when the effort changes |
| side | "top" | "bottom" | "top" | Open the list above the button (composer at the bottom) or below it |
| autoPlay | boolean | false | Loop a scripted pick while on screen, for demos. Stops once the viewer clicks |
| className | string | – | Extra classes on the wrapper |
Sign in to see the code
Preview it freely. A free account copies code and prompts a few times a day.