Skip to content
Sign upGet access
MicrointeractionsModel coinMenu

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.

Switch models and the mark flips like a coin while the name rolls over and the chip eases to its new width.

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

$ pnpm dlx 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

Six models, each coin in its own tone, so a model is known by its color before its name.

Props

PropTypeNotes
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
trailingReactNodeAfter 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.