Cooldown Button
Cooldown Button: Button that locks itself behind a draining radial timer after each click to prevent spam and double submits. Free MIT React & Next.js source with Motion and Tailwind CSS, live preview, CLI install and docs.
Install Cooldown Button
npx motion-ui-skill add cooldown-buttonComponents install as source into your project. The interactive page also includes preview, code, documentation and install tabs.
Dependencies
clsxmotionreacttailwind-merge
Source files
Cooldown Button
Button that locks itself behind a draining radial timer after each click to prevent spam and double submits.
Install
npx motion-ui-skill add cooldown-button
Dependencies
clsxmotionreacttailwind-merge
Usage
"use client";
import { CooldownButton } from "@/components/buttons/cooldown-button";
export function CooldownButtonDemo() {
return (
<div className="flex items-center justify-center p-6">
<CooldownButton>Click Me</CooldownButton>
</div>
);
}
API Reference
CooldownButton
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
cooldownMs |
number |
3000 | No | Duration of lockout in milliseconds |
className |
string |
— | No | Additional CSS classes |
children |
React.ReactNode |
— | No | Button label content |