Hold Button

Hold to confirm: a fill rises while you hold, and the action fires when it's full.

no dependenciesMIT · free

Confirmed 0 times. Let go early and nothing happens.

Installation

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

Usage

import { HoldButton } from "@/components/hold-button";

<HoldButton holdTime={1200} onConfirm={deleteProject} doneLabel="Deleted">
  Hold to delete
</HoldButton>

Props

PropTypeDefaultDescription
childrenReactNode–Button content while idle.
doneLabelReactNode"Done"Content shown after the action is confirmed.
holdTimenumber1200Milliseconds the button must be held.
onConfirm() => void–Called once the hold completes.
resetAfternumber1800Milliseconds before the button resets after confirming. 0 keeps it done.
classNamestring–