Slide to Confirm

Slide-to-unlock control for risky actions

A deliberate alternative to a confirm dialog: drag the knob to the end to fire the action, release early and it springs back. The prompt carries a slow shimmer and fades as you drag.

Preview

Deploy website

main · 8f4ac2d

Ready
Slide to deploy

Drag, or use Enter and arrow keys.

Installation

Install the component using the CLI.

npx shadcn@latest add https://rohan.run/r/slide-to-confirm.json

Usage

Import the component:

import { SlideToConfirm } from "@/components/rohan/slide-to-confirm"

Use it in your code:

<SlideToConfirm
  label="Slide to deploy"
  confirmedLabel="Deployed"
  onConfirm={() => deploy()}
/>

Props

PropertyTypeDefaultDescription
labelstring"Slide to confirm"Prompt shown in the track.
confirmedLabelstring"Confirmed"Label shown after confirming.
onConfirm() => voidFired once the knob reaches the end of the track.
resetAfternumber0Auto-reset delay in ms. 0 keeps it confirmed.
classNamestringOptional CSS classes for the track.
Components