Hold ToConfirm

A button that requires holding down to confirm irreversible or critical actions.

Loading...

Installation

npx shadcn@latest add @scrollxui/hold-toconfirm 

Usage

import { HoldToConfirm } from '@/components/ui/hold-toconfirm';
<HoldToConfirm
  variant='style'
  size='dimension'
  duration={time}
  onConfirm={callback}
  animation='border-or-fill'
  fillClassName='styles'
  confirmedChildren={content}
  confirmedClassName='styles'
  resetAfter={time}
  showProgressOnConfirm={boolean}
>
  content
</HoldToConfirm>

Examples


Border Variant

Loading...

API Reference

Hold ToConfirm

A button that requires holding down to confirm irreversible or critical actions.

Props

PropertyTypeDefaultDescription
asChildbooleanfalse
Renders as a span instead of a button when true.
durationnumber2000
Hold duration in milliseconds required to confirm.
onConfirm() => void-
Callback fired once the hold is successfully confirmed.
animation"border" | "fill""fill"
Style of the progress animation: border outline or background fill.
fillClassNamestring-
Classes applied to the progress fill/border element.
confirmedChildrenReactNode-
Content shown inside the button after confirmation.
confirmedClassNamestring-
Classes applied to the confirmed state content.
resetAfternumber2000
Time in milliseconds after which the button resets state.
showProgressOnConfirmbooleanfalse
Keeps progress visible after confirmation instead of resetting immediately.
childrenReactNode"Hold"
Button label or content shown before confirmation.
variantstring-
Variant styles inherited from Button (e.g., default, outline).
sizestring-
Size styles inherited from Button (e.g., sm, lg).
classNamestring-
Additional custom classes applied to the button.

Built withby Ahdeetai.