Model Selector
A chip with the current thinking effort that expands into a slider and a list of models.
"use client";
import { useState } from "react";
import { Card } from "@/components/ui/card";
import { ChatgptModelSelector } from "../components/chatgpt-model-selector";
import type { ChatgptEffortId, ChatgptModelId } from "../types/chatgpt";
export default function ChatgptModelSelectorExample() {
const [model, setModel] = useState<ChatgptModelId>("latest");
const [effort, setEffort] = useState<ChatgptEffortId>("medium");
return (
<Card className="border-chatgpt-border bg-chatgpt-bg font-chatgpt text-chatgpt-fg flex w-full min-w-0 items-center justify-end gap-0 rounded-2xl border px-6 pt-36 pb-6 text-base ring-0">
<ChatgptModelSelector
effort={effort}
model={model}
onEffortChange={setEffort}
onModelChange={setModel}
/>
</Card>
);
}
$ bunx --bun shadcn@latest add @notra/chatgpt-model-selectorThe chip is a shadcn Popover. Its content is a shadcn Slider with one stop per effort: Instant, Medium, High, Extra High and Pro. The thumb snaps to the stops, and the fill turns into the purple Pro gradient at the last one. The current effort sits above the slider. Click it to switch to the list of models, and picking one goes back to the slider.
While the popover is open the chip reads “Thinking effort”. Closed, it shows the current effort, like Medium. With Pro selected it shows Pro, or the model prefix with it, like 5.6 Pro, when a model other than Latest is picked. The popover grows out of the chip from its corner and respects reduced motion.
| Prop | Default | Description |
|---|---|---|
model, onModelChange |
The selected model. | |
effort, onEffortChange |
The selected effort. | |
models |
CHATGPT_MODELS |
The model list. A model can have a description, like “Leaving on October 14”, and a shortLabel for the chip. |
efforts |
CHATGPT_EFFORTS |
The slider stops, from left to right. The pro id gets the gradient. |
Used in
ChatGPT
A full recreation of a ChatGPT conversation with thinking, web search, reasoning and the model picker.