Skip to Content
Kokonut UI

BT-05Buttons

Hold Button

Press and hold to confirm, with a fill that drains back on early release and a drawn check on completion.

Install with
class-variance-authority, lucide-react, motion

PROPay Button and more like it are in Kokonut UI Pro

Installation

Hold Button is a free, open-source React component in the Kokonut UI Buttons collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/hold-button.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/hold-button

Or add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/hold-button.tsx.

npm install class-variance-authority lucide-react motion

Usage

import HoldButton from "@/components/kokonutui/hold-button";

export default function Example() {
  return <HoldButton />;
}

Props

children
ReactNode

Idle label. Defaults to a verb that matches the variant.

holdDuration
numberDefault 1200

How long (ms) the button has to be held.

holdingLabel
ReactNodeDefault "Keep holding"

Label while holding.

completeLabel
ReactNode

Label once the hold completes.

resetAfter
numberDefault 1800

How long (ms) the complete state shows before resetting. 0 keeps it.

onHoldComplete
() => void

Called once the button has been held for the full holdDuration. A short click or an early release never calls it.

Also takes every prop of Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> and VariantProps<typeof holdButtonVariants>.

Dependencies

NeedsVersionComes from
class-variance-authority^0.7.1npm, installed by the CLI
lucide-react^0.556.0npm, installed by the CLI
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.