# Tone dial

Tone as a track the text follows: drag from formal to casual and the text rewrites itself, word by word.

Also called: tone slider, rewrite tone.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: Tone you can drag. Slide from formal to casual and the reply rewrites itself: shared words glide to their new places, changed words blur out and in. Preview: https://chatcn.dev/preview/tone-dial-demo

Drag the thumb and the text rewrites itself at each stop: words both versions share glide to their new places, words that change blur out and in where they stand, and the paragraph eases to its new height. The thumb settles into stops on a spring. Give one version of the text per stop.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/tone-dial
```

## Usage

```tsx
import { ToneDial } from "@/components/ui/chatcn/pro/tone-dial"

<ToneDial variants={[{ label: "Formal", text }, { label: "Casual", text }]} value={tone} onValueChange={setTone} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `variants` | `{ label, text }[]` | One per stop, in order |
| `value` / `onValueChange` | `number` |  |
| `ends` | `[string, string]` | Default Formal and Casual |

## Keyboard

| Key | Action |
| --- | --- |
| `ArrowRight` / `ArrowUp` | Next stop |
| `ArrowLeft` / `ArrowDown` | Previous stop |
| `Home` / `End` | First or last stop |

## Accessibility

- A `role="slider"` whose value text is the stop name; the text is a polite live region.

## Motion

- Words are matched by longest common run; kept words move with a FLIP from their old box, new ones blur in 12 ms apart. Wrapping still happens at the spaces.
- Reduced motion: the text swaps in place.

Source: https://chatcn.dev/docs/components/tone-dial