# Detent knob

A rotary switch that clicks into fixed positions and stops hard at both ends. For a few ordered settings where the order matters: reasoning effort, quality presets, verbosity.

- Category: Instruments
- Docs: https://bevel-ui.vercel.app/components/detent-knob
- Import from: `@/components/ui/detent-knob`

## Install

```bash
npx shadcn@latest add @bevel/detent-knob
```

npm dependencies (installed by the CLI): `cn`.

## Anatomy

```tsx
<DetentKnob aria-label="Reasoning effort" value={effort} onValueChange={setEffort}>
  <DetentKnobStop value="low">Low</DetentKnobStop>
  <DetentKnobStop value="medium">Medium</DetentKnobStop>
  <DetentKnobStop value="high">High</DetentKnobStop>
</DetentKnob>
```

## Parts

| Part | Renders | Description |
| --- | --- | --- |
| `DetentKnob` | div (slider) | value, defaultValue, onValueChange, disabled. Arrow keys, Home and End, or drag round; it gives a little at the ends. Reads as “High, 3 of 4”. |
| `DetentKnobStop` | nothing | One position, in order. Its text is drawn round the dial. |

## Example: Reasoning effort

Turn the knob to trade speed and cost for how hard the model thinks.

```tsx
"use client"

import * as React from "react"
import { DetentKnob, DetentKnobStop } from "@/components/ui/detent-knob"

const what: Record<string, string> = {
  low: "Quick answers. Fastest and cheapest.",
  medium: "Thinks before answering. The default.",
  high: "Works through hard problems step by step.",
  max: "Takes as long as it needs. Slowest and most expensive.",
}

/** How hard the model thinks, on a switch that clicks into place. */
export function DetentKnobEffort() {
  const [effort, setEffort] = React.useState("medium")
  return (
    <div className="flex flex-col items-center gap-2">
      <DetentKnob aria-label="Reasoning effort" value={effort} onValueChange={setEffort}>
        <DetentKnobStop value="low">Low</DetentKnobStop>
        <DetentKnobStop value="medium">Medium</DetentKnobStop>
        <DetentKnobStop value="high">High</DetentKnobStop>
        <DetentKnobStop value="max">Max</DetentKnobStop>
      </DetentKnob>
      <p className="max-w-64 text-center text-sm text-muted-foreground">{what[effort]}</p>
    </div>
  )
}
```
