5 left
Swap
Markup where the component goes, CSS in your stylesheet, script before </body>. In Vue, Svelte or Angular, call initCardSwap(el) on the mounted element instead.
Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Install with shadcn
Needs a free account token. Get a token
npx shadcn@latest add @movin/card-swapAbout this component
A token swap with two wells of big figures and coin chips. Type in Pay and Receive recomputes with a roll; the round button on the seam spins half a turn while the coins and amounts roll across to trade places, its two-colour rim turning with them.
Triggers
- Card
- Click
- Spring
- State change
- Gradient
- Focus
Techniques
- Keyframes
- CSS transition
- Radial gradient
- Pseudo elements
- CSS variables
- State machine
Difficulty
Intermediate
Accessibility
Keyboard and screen readers
Pay is a labelled input (inputmode decimal) and Receive an output tied to it in an aria-live region; the flip button is labelled 'Swap direction'. All three controls show a visible focus ring.
Reduced motion
Reduced motion swaps without animation.
Use it in anything you build, commercial and client work included. Licence
More cards
See allORBT
152.75, up 7.27 percent over one day