# 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](/content/docs/inputs/index.html). Add it with the shadcn CLI, which copies the source into `components/kokonutui/tip-selector.tsx`, so the code is yours to change.

```bash
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`.

```bash
npm install lucide-react motion
```

## Usage

```javascript
import TipSelector from "@/components/kokonutui/tip-selector";

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

## Props

- `subtotal`
  - `number` Default `42.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.
- `percents`
  - `number[]` Default `[15, 18, 20]`
  - Marked on the tape and offered as shortcuts, in percent.
- `defaultPercent`
  - `number` Default `18`
  - Where the tape starts.
- `max`
  - `number` Default `30`
  - The far end of the tape, in percent.
- `currency`
  - `string` Default `"$"`
- `onChange`
  - `(tip: number) => void`
- `onPay`
  - `(total: number) => void`
- `className`
  - `string`
  - 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.
