ModelPicker

The model switch beside a prompt box. The name on the button rolls to the new one, and the menu is keyboard-first. AI.

Open playground

About

ModelPicker is a React component in the AI category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ModelPicker } from "@ashutoshswamy/smoui" and set models, value, defaultValue among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ModelPicker } from "@ashutoshswamy/smoui";

<ModelPicker
  models={[{ id: "a", name: "Large", tag: "Smartest" }, { id: "b", name: "Small", tag: "Fast" }]}
  value={model}
  onChange={setModel}
/>

Props 4

models

The choices. tag shows on the right of its menu row.

{ id; name; tag? }[]
value

Controlled model id.

string
defaultValue

Starting id when uncontrolled.

string
onChange

Called with the chosen id.

(id: string) => void