Swap

Nova
Receive48
Kite
No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/card-swap

About 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 all
TearGet code

ORBT

152.75, up 7.27 percent over one day

TickerGet code
ZonesGet code

Design review

Live
  • Mina, speaking
  • Omar
  • Leo
  • Ama
  • Noor
8
HuddleGet code