Swipe to Confirm

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/button-swipe-confirm

About this component

A slide-to-confirm track for actions that should not happen by accident. Drag the knob to the end and the track floods light while the arrow redraws as a check; let go early and it springs home. One registered custom property drives the knob, the fill and the hint, so a single transition animates all three.

Triggers

  • Click
  • Spring
  • State change
  • Draw

Techniques

  • @property
  • CSS variables
  • stroke-dashoffset
  • Event position
  • State machine

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

The knob is a real <button>: Enter or Space slides it to the end and confirms, and its aria-label changes to say it is confirmed.

Reduced motion

Every animation and transition is removed.

Use it in anything you build, commercial and client work included. Licence

More buttons

See all
TicketGet code
TideGet code
Tile FlipGet code
Border BeamGet code