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.
  • onDelete callback fires only on full completion.
  • Automatically resets after the success state.

Playground

Controls
Button label
Hold duration (ms)2000

Installation

Usage

Props

PropertyTypeDefaultDescription
labelstringText displayed inside the button.
holdDurationnumber2000Duration in milliseconds the user must hold before the action triggers.
successDurationnumber1200Duration in milliseconds the success state is visible before auto-resetting.
onDelete() => voidCalled once when the hold completes.
classNamestringAdditional CSS classes for the button.