Drag to Confirm

A minimalist physical drag-to-confirm slider for high-stakes and destructive actions, equipped with progressive track fill physics, spring snapback resistance, full light/dark theme adaptation, and accessible keyboard controls.

Slide to delete database →
Drag slider or press Enter / Space to trigger
Protects critical databases with explicit drag confirmation

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/drag-to-confirm

API Reference

PropTypeDefaultDescription
labelstring'Slide to confirm'Action instruction text rendered along track
confirmedLabelstring'Confirmed ✓'Text shown when slider locks into completion
actionType'delete' | 'archive' | 'confirm' | 'submit' | 'unlock' | 'continue''confirm'Action preset style and icon archetype
variant'default' | 'danger' | 'warning' | 'info' | 'success'undefinedVisual tone variant override
size'sm' | 'md' | 'lg''md'Slider dimension profile (sm: 40px, md: 48px, lg: 54px)
iconReact.ReactNodeundefinedCustom idle state icon rendered inside thumb
confirmedIconReact.ReactNodeundefinedCustom confirmed state icon rendered inside thumb
isConfirmedbooleanundefinedControlled confirmation state
onConfirm() => voidundefinedCallback triggered upon successful confirmation completion
onReset() => voidundefinedCallback triggered upon slider reset
autoResetDelaynumber2500Milliseconds before resetting back to start (0 to disable)
hapticbooleantrueTriggers subtle vibration feedback upon confirmation
disabledbooleanfalseDisables slider gesture and interaction