TipSplitter

Split a bill: type the total, pick a tip, set the headcount. Each share rolls to its new figure, rounded up so the table is never short. Finance.

Open playground
People
3

Each person pays

$33.12

Tip$12.96of$99.36

About

TipSplitter is a React component in the Finance category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { TipSplitter } from "@ashutoshswamy/smoui" and set defaultBill, defaultTip, defaultPeople among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { TipSplitter } from "@ashutoshswamy/smoui";

<TipSplitter defaultBill={86.4} defaultTip={15} defaultPeople={3} />

Props 5

defaultBill

Starting total.

number
defaultTip

Starting tip in percent.

number
defaultPeople

Starting headcount.

number
tips

Tip choices. Default 10, 15, 20, 25.

number[]
currency

ISO code. Default USD.

string