Tip Selector - React Component | Kokonut UI
Tip Selector
A tip picker for checkout, set on a tape you drag and flick. The ticks you pass fill in, the amounts roll, and Round up makes the total a whole amount.
Install with npx shadcn@latest add https://kokonutui.com/r/tip-selector.json, then show me how to use it.
Installation
Tip Selector is a free, open-source React component in the Kokonut UI Inputs collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/tip-selector.tsx, so the code is yours to change.
npx shadcn@latest add @kokonutui/tip-selector
Or add it by hand: install its packages, then copy the source from above into components/kokonutui/tip-selector.tsx.
npm install lucide-react motion
Usage
import TipSelector from "@/components/kokonutui/tip-selector";
export default function Example() {
return <TipSelector />;
}
Props
subtotalnumberDefault42.6- The order before the tip.
recipient{ name: string; note?: string }Default{ name: "Sam", note: "Your courier · 6 min early" }- Who the tip goes to.
percentsnumber[]Default[15, 18, 20]- Marked on the tape and offered as shortcuts, in percent.
defaultPercentnumberDefault18- Where the tape starts.
maxnumberDefault30- The far end of the tape, in percent.
currencystringDefault"$"
onChange(tip: number) => void
onPay(total: number) => void
classNamestring- Extra classes for the root element.
Dependencies
| Needs | Version | Comes from |
|---|---|---|
lucide-react |
^0.556.0 |
npm, installed by the CLI |
motion |
^12.23.25 |
npm, installed by the CLI |
cn from lib/utils.ts |
shadcn init | |
| React | 19 |
Your app |
| Tailwind CSS | 4 |
Your app |
No provider, font or global CSS to set up: the file works as soon as it lands.