All components

MotionHold

Press and hold to confirm a destructive action; an early release rewinds.

WebReact NativeGestures

Try it

Preparing the example…

Shortest usage

Danger.jsx
<MotionHold duration={1200} onConfirm={deleteProject}>
  Hold to delete
</MotionHold>;

What it handles for you

  • The fill grows while the pointer, Space or Enter is held.
  • Releasing early rewinds the fill, and pressing again mid-rewind continues from the current fill.
  • The button presses in while held and pops once when confirmed.

Use it for

  • Delete a project.
  • Hold to pay.
  • Reset settings.

Props

PropTypeDefaultDescription
childrenReactNodeThe button label.
onConfirm() => voidRuns once the hold completes.
durationnumber1200Milliseconds the press must be held.
disabledbooleanfalseTurns the button off.
fillClassNamestringClass for the growing fill; fillStyle sets its inline style.

Other props go to the rendered element, so className, style and event handlers work as usual.

Web and React Native

Style the fill with fillClassName or fillStyle; other props go to the button.

On React Native the accessibility activate action confirms directly, because holding is hard with assistive technology.

Used in these examples

Search

Type to search the documentation.