Hold Button

Hold Button

A hold-to-confirm button — press and keep pressing while ink floods across the label; let go early and it snaps back, hold to the end and it commits with a pop.

Installation

▸ Run the following command

npx shadcn@latest add https://www.mellowui.com/r/hold-button.json

▸ Or install manually

  1. Install dependencies: pnpm add motion
  2. Copy the source from the Code tab above.
  3. Place it at components/mellow/hold-button.tsx
  4. Import and use.

API Reference

PropTypeDefaultDescription
childrenReact.ReactNodeButton label.
onConfirm() => voidCalled once when the hold completes.
holdMsnumber900How long the press must be held, in ms.
confirmedLabelReact.ReactNode"Confirmed"Label shown briefly after the hold completes.
resetMsnumber1500Ms before the button re-arms after confirming.
dangerbooleanfalseDestructive styling — red border, label, and ink flood.
classNamestringAdditional CSS classes.