# Sheet model picker

The model and mode picker for phones: a bottom sheet with half and full heights, drag, flick and native feeling physics.

> 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: Sheet model picker. Tap the model chip in the composer, then drag the sheet up for every model or flick it away. Preview: https://chatcn.dev/preview/sheet-model-picker-demo

## Installation

```bash
npx shadcn@latest add @chatcn-pro/sheet-model-picker
```

## Usage

```tsx
import { SheetModelPicker } from "@/components/ui/chatcn/pro/sheet-model-picker"

<div className="relative h-dvh">   {/* the screen the sheet covers */}
  …
  <SheetModelPicker
    models={[{ id: "claude-sonnet-5-5", name: "Claude Sonnet 5.5", provider: "anthropic", recommended: true }, …]}
    modes={[{ id: "fast", label: "Fast" }, { id: "thinking", label: "Thinking", description: "Thinks before answering" }]}
    value={model}
    onValueChange={setModel}
    mode={mode}
    onModeChange={setMode}
  />
</div>
```

A chip shows the model and mode; tapping it opens a sheet at half height with the modes and the models marked `recommended`, the choices most people make. Drag it up, or tap All models, and it rises to full height with search and every model by provider. The sheet follows the finger 1:1, resists past the top, and on release carries the flick's momentum to the nearest height on a critically damped spring; a flick down dismisses. Grab it mid flight and it stops under the finger. When the list is scrolled to the top, pulling down drags the sheet, as native sheets do. A pick closes it a beat later so the check is seen. The sheet covers the nearest positioned ancestor, so it works full screen and inside a phone frame. Models use the free `model-picker` shape, including `disabled` with a reason and `isNew`.

## Examples

### States

Example: States. At real phone width, with models only and no modes. Preview: https://chatcn.dev/preview/sheet-model-picker-states

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `models` | `SheetModel[]` | `ModelOption` plus `recommended?` |
| `providers` | `ModelProvider[]` | Group names and order |
| `value`, `defaultValue`, `onValueChange` | `string` | The model |
| `modes` | `SheetMode[]` | `{ id, label, description? }`; leave out for models only |
| `mode`, `defaultMode`, `onModeChange` | `string` | The mode |
| `labels` | `Partial<SheetModelPickerLabels>` | Every string, for translation |

## Keyboard

| Key | Action |
| --- | --- |
| Enter, Space on the chip | Open |
| Arrow up, down on the grabber | Full height, half height, close |
| Arrow left, right in modes | Change mode |
| Tab | Stays inside the sheet |
| Escape | Close; focus returns to the chip |

## Accessibility

- The sheet is a modal dialog named Model; models are listbox options that report selection.
- The grabber is a button named with the current height, so every gesture has a keyboard path.
- Focus moves into the sheet on open and back to the chip on close.

## Motion

The sheet moves on a critically damped spring (no overshoot) over about 520 ms and the scrim follows its height. Under reduced motion it slides in 150 ms with a plain ease.

Source: https://chatcn.dev/docs/components/sheet-model-picker