All components
MotionHold
Press and hold to confirm a destructive action; an early release rewinds.
WebReact NativeGestures
Try it
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
| Prop | Type | Default | Description |
|---|
children | ReactNode | | The button label. |
|---|
onConfirm | () => void | | Runs once the hold completes. |
|---|
duration | number | 1200 | Milliseconds the press must be held. |
|---|
disabled | boolean | false | Turns the button off. |
|---|
fillClassName | string | | Class 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.