Skip to Content
Kokonut UI

BT-14ButtonsNew, October 21, 2026

Slide to Confirm

A confirm control for payments and other actions you can't take back. Slide the thumb to the end, or flick it.

Install with
lucide-react, motion

PROTaking payments? Pay Button is in Kokonut UI Pro

Installation

Slide to Confirm 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/slide-to-confirm.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/slide-to-confirm

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

npm install lucide-react motion

Usage

import SlideToConfirm from "@/components/kokonutui/slide-to-confirm";

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

Props

label
stringDefault "Slide to pay $48.00"

What sliding does, e.g. "Slide to pay $48.00".

confirmingLabel
stringDefault "Paying"

Read out while onConfirm runs.

doneLabel
stringDefault "Paid"

Shown once it's done, e.g. "Paid".

onConfirm
() => Promise<unknown> | unknownDefault () => wait(1200)

The real work. Return a promise to keep the spinner up until it settles; a rejected promise sends the thumb back to the start.

resetAfter
number | nullDefault 2600

Go back to the start this many ms after it's done. null stays done.

disabled
booleanDefault false
className
string

Extra classes for the root element.

Dependencies

NeedsVersionComes from
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.