Slide to confirmPro
Drag the handle to the end to confirm a payment or action; Enter works too.
Pro · yearly$129.00
Tax$0.00
Or focus the handle and press Enter.
When to use
- Payments, transfers and launches on touch screens, where a deliberate gesture builds trust.
When not to use
- Desktop-first forms: a button is faster.
- Anything that needs a review step: confirm first.
Installation
Usage
Import it from @/components/ui/slide-to-confirm after installing.
example.tsx
import { SlideToConfirm } from "@/components/ui/slide-to-confirm";
export function Pay({ amount }: { amount: string }) {
return <SlideToConfirm label={`Slide to pay ${amount}`} doneLabel="Payment sent" onConfirm={submitPayment} />;
}API reference
SlideToConfirm
A track with a draggable handle; reaching the end confirms.
| Prop | Type | Default | Description |
|---|---|---|---|
| onConfirm | () => void | Promise<void> | – | Runs when the handle reaches the end or Enter is pressed. |
| label / doneLabel | string | "Slide to confirm" / "Confirmed" | Track text before and after. |
| resetAfter | number | 2400 | ms before resetting; 0 keeps the done state. |
| disabled | boolean | – | Dims and locks the handle. |
Keyboard interactions
| Keys | Action |
|---|---|
| EnterorSpace | Confirm (on the handle) |
Accessibility
- The handle is a button that tells keyboard users to press Enter.
- The result is announced politely.
Motion
- The track text shimmers and fades as you drag; the fill follows the handle.
- Releasing short of 85% springs it back; reaching the end snaps it over and turns it green.
Responsive behavior
- Fills up to 384px; the drag range is measured, so any width works.
Performance
- Handle position is a motion value; layout is measured once per resize.
Notes for AI
- Put the amount in the label so the gesture confirms something specific.
This page as Markdown, for assistants and coding agents:
/components/slide-to-confirm/markdownThe full library index for assistants is at /llms.txt.
Lode222 doc pagesllms.txt