Hold To Delete Button
A button that fills with a destructive color while held down, triggering the action only after the full hold duration completes. Releases cleanly if the user lets go early.
Features
- CSS clip-path fill animation driven by hold duration — no jank.
- Configurable hold and success display durations.
onDeletecallback fires only on full completion.- Automatically resets after the success state.
Playground
Controls
Button label
Hold duration (ms)2000
Installation
Usage
Props
| Property | Type | Default | Description |
|---|---|---|---|
label | string | — | Text displayed inside the button. |
holdDuration | number | 2000 | Duration in milliseconds the user must hold before the action triggers. |
successDuration | number | 1200 | Duration in milliseconds the success state is visible before auto-resetting. |
onDelete | () => void | — | Called once when the hold completes. |
className | string | — | Additional CSS classes for the button. |