Search

Search components and flows across the catalog

ThatDesignUIOriginalInteractive preview

Hold to confirm button

A destructive action that only happens if you press and hold: red fills the button left to right, letting go early drains it back.

Category
Buttons
Platform
Responsive

Interactive componentClick through it, resize it, or switch states. It’s real UI, not a screenshot.Default state

Use this component

Free to use. It works on its own in any React and Tailwind project, so you can add it with one command, paste the code, or hand the prompt to your coding agent.

FreeReact 18+Tailwind v3.4 or v4No extra packages

1. Add it with the shadcn CLI

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

2. Use it

Every prop is optional
app/page.tsx
import HoldToConfirmButton from "@/components/hold-to-confirm-button";

export default function Page() {
  return <HoldToConfirmButton />;
}

Prefer to paste it yourself? Open the .

Under the hood

How it’s built

What’s inside

  1. A 56px white button with a 2px red (#dc2626) border and red text, at least 16rem wide, with a one-line hint underneath saying how long to hold.
  2. While held (pointer, Enter or Space) a red fill grows from the left over the hold time; the label turns white past halfway.
  3. Completing the hold shows the done label with a check for two seconds, then resets; releasing early drains the fill in 250ms.

How it behaves

  • A quick click does nothing; only a full hold confirms.
  • Holding Enter or Space works the same as holding the pointer, and releasing cancels.
  • The label and the result are announced, and the hint is linked with aria-describedby.
  • Moving the pointer off the button while holding cancels.

More from ThatDesignUI

Image gallery lightbox

Image gallery lightbox

ThatDesignUIOriginalMedia component

Notification center

Notification center

ThatDesignUIOriginalNotifications component

Interactive chart card

Interactive chart card

ThatDesignUIOriginalDashboard component

Multi-select combobox

Multi-select combobox

ThatDesignUIOriginalForms component