import { useState } from "react";import { ThinkingEffort, type ThinkingEffortModel, type ThinkingEffortValue } from "@/components/ui/thinking-effort";const MODELS: ThinkingEffortModel[] = [{id: "gpt-6",name: "GPT-6",efforts: [{ value: "instant", label: "Instant" },{ value: "medium", label: "Medium" },{ value: "high", label: "High" },{ value: "xhigh", label: "Extra High" },{ value: "pro", label: "Pro" },],defaultEffort: "medium",},{id: "gpt-5.6-sol",name: "GPT-5.6 Sol",efforts: [{ value: "instant", label: "Instant" },{ value: "medium", label: "Medium" },{ value: "high", label: "High" },{ value: "xhigh", label: "Extra High" },{ value: "pro", label: "Pro" },],defaultEffort: "medium",},];export default function ThinkingEffortDemo() {const [value, setValue] = useState<ThinkingEffortValue>({ model: "gpt-6" });return <ThinkingEffort models={MODELS} value={value} onValueChange={setValue} defaultModelId="gpt-6" />;}
Effort labels and order come from your model data. Switching models clears the effort override and uses that model’s default.
Installation
npx shadcn@latest add https://www.deltacomponents.dev/r/thinking-effort.json
Usage
1"use client";23import { useState } from "react";4import { ThinkingEffort, type ThinkingEffortModel, type ThinkingEffortValue } from "@/components/ui/thinking-effort";56const models: ThinkingEffortModel[] = [7 { id: "gpt-6", name: "GPT-6", efforts: [{ value: "medium", label: "Medium" }, { value: "high", label: "High" }], defaultEffort: "medium" },8];910function Example() {11 const [value, setValue] = useState<ThinkingEffortValue>({ model: "gpt-6" });12 return <ThinkingEffort models={models} value={value} onValueChange={setValue} defaultModelId="gpt-6" />;13}
value owns the selection. Changing models or choosing Use model default calls
onValueChange with only { model }; selecting an effort includes its effort value.
defaultModelId highlights and orders a model in the menu; set value.model to
choose the initial model.
Supply only the effort options your application supports, ordered from least to most
work. The demo uses sample application IDs; map them to your provider’s request format.
The slider fill uses the shared --focus-ring blue token.