Hold Button
Hold Button: Hold-to-confirm button whose inner fill grows smoothly from 0 to 100% with shake-to-abort feedback. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.
Install Hold Button
npx motion-ui-skill add hold-buttonComponents install as source into your project. The interactive page also includes preview, code, documentation and install tabs.
Dependencies
clsxreacttailwind-merge
Source files
Hold Button
Hold-to-confirm button whose inner fill grows smoothly from 0 to 100% with shake-to-abort feedback.
Install
npx motion-ui-skill add hold-button
Dependencies
clsxreacttailwind-merge
Usage
"use client";
import { HoldButton } from "@/components/buttons/hold-button";
export function HoldButtonDemo() {
return (
<div className="flex items-center justify-center p-6">
<HoldButton>Click Me</HoldButton>
</div>
);
}
API Reference
HoldButton
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
durationMs |
number |
1500 | No | Required continuous press duration |
onComplete |
() => void |
— | No | Triggered when hold fill reaches 100% |
className |
string |
— | No | Additional CSS classes |