# Model coin

The model in use as a coin: switching flips the mark on its axis while the name rolls over to the new one.

Also called: model switch animation, coin flip.

Example: The model, as a coin. Switch models and the mark flips like a coin while the name rolls over and the chip eases to its new width. Preview: https://chatcn.dev/preview/model-coin-demo

Switch models and the coin flips on its vertical axis, the old mark on its face and the new one on its back, while the name rolls over to the new one and the chip eases to its new width. It only animates the change, so it works as the trigger of any model picker. Without a mark the coin shows the name's initials, in the model's own colour.

## Installation

```bash
npx shadcn@latest add https://chatcn.dev/r/model-coin.json
```

## Usage

```tsx
import { ModelCoin } from "@/components/ui/chatcn/model-coin"

<ModelCoin model={{ id: "opus", name: "Opus 5.5", mark: <YourMark /> }} trailing={<ChevronDownIcon />} />
```

## Examples

### Tones

Example: A color per model. Six models, each coin in its own tone, so a model is known by its color before its name. Preview: https://chatcn.dev/preview/model-coin-tones

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `model` | `{ id, name, mark?, tone? }` | A new `id` plays the flip. `tone` colours the coin: blue, teal, purple, amber, green or red; by default each id keeps its own |
| `trailing` | `ReactNode` | After the name, usually a chevron |

## Accessibility

- A button whose text is the model's name; give it `aria-haspopup` and `aria-expanded` from your picker.
- The coin faces are decorative.

## Motion

- A 520 ms flip in 3D (`perspective` 160 px), with both faces `backface-visibility: hidden`. The name rolls 320 ms; the width eases 320 ms.
- Reduced motion: the mark and name swap in place.

Source: https://chatcn.dev/docs/components/model-coin