Split Allocator

Split Allocator is a copy-paste React component that stops split adds up to 101% before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/split-allocator
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsSplit adds up to 101%

Was this component page useful?

How do I install Split Allocator?

pnpm dlx shadcn@latest add @bollard/split-allocator

The files land in your project. They're yours to edit.

How do I use Split Allocator in React?

split-allocator-usage.tsx
import { SplitAllocator } from "@/components/ui/split-allocator"

<SplitAllocator label="Equity split" items={founders} defaultValue={{ priya: 50, rahul: 38 }} />

What input mistakes does Split Allocator catch?

  • Totals over or under (99%, 101%)
  • Rows left on 0
  • Remainder, assignable to any row in one tap
  • Automatic splits that would drift by rounding, fixed with largest-remainder

What props does Split Allocator accept?

SplitAllocator props
PropTypeDefault
items* (required)

Rows to split across.

SplitItem[]—
total

The amount being split: 100 for percentages, or a sum of money.

number100
precision

Decimal places each share is rounded to (2 for rupees and paise).

number0
prefix

Shown before each amount, e.g. "₹".

string""
suffix

Shown after each amount, e.g. "%".

string"%"
locale

Number formatting locale.

string"en-IN"
label

Visible legend.

string"Split"
value

Controlled shares by item id.

Record<string, number>—
defaultValue

Initial shares when uncontrolled.

Record<string, number>{}
onValueChange

Called with every row's share on each change.

(value: Record<string, number>) => void—
remainingText

Templates: `{amount}`, `{total}`, `{label}` and `{labels}` are filled in.

string"{amount} left to assign"
overText

Shown when the parts exceed the total.

string"Over by {amount}."
doneText

Shown when the parts add up exactly.

string"All {total} assigned"
zeroText

Warning for a row left on zero.

string"{labels} would get nothing."
giveRestLabel

Label of the give-the-rest fix.

string"Give the remaining {amount} to {label}"
takeOverLabel

Label of the take-the-excess fix.

string"Take the extra {amount} from {label}"
scaleLabel

Label of the scale-to-total fix.

string"Scale down to fit"
evenLabel

Label of the split-evenly button.

string"Split evenly"

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Split Allocator accessible?

  • Group labelled by its label; each row input has a <label>
  • aria-invalid when over the total; status in a polite live region via aria-describedby
  • Give-rest/take-over buttons have aria-labels with the amount
  • Progress bar is aria-hidden; the numbers are in text

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Even and proportional splits only; custom rules are yours
  • Uses decimal precision you set; currency minor units must match

What expensive mistakes does Split Allocator stop?

Split adds up to 101%

Also known as

split · allocation · split bill · percentages · splitwise · revenue share · budget allocation · rounding

Field type

What dependencies does Split Allocator require?

Split Allocator facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameSplit Allocator
Registry identifier@bollard/split-allocator
Install commandnpx shadcn@latest add @bollard/split-allocator
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Split Allocator

How does Split Allocator prevent financial transaction errors?

Split Allocator prevents split adds up to 101%. Blocks Totals over or under (99%, 101%), Rows left on 0, Remainder, assignable to any row in one tap, Automatic splits that would drift by rounding, fixed with largest-remainder before processing. Limitation: apply idempotency keys for split-allocator.

How do I install split-allocator with shadcn?

Run `npx shadcn@latest add @bollard/split-allocator`. Sources added: registry/default/split-allocator/split-allocator.tsx. Package requirements: lucide-react.

What props customize Split Allocator?

Split Allocator accepts `items`, `total`, `precision`, `prefix`, `suffix`. Configures split, allocation, split bill behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of split-allocator?

Even and proportional splits only; custom rules are yours. Uses decimal precision you set; currency minor units must match Server requirement: backend verification for split-allocator.

How does Split Allocator meet accessibility guidelines?

Group labelled by its label; each row input has a <label>. aria-invalid when over the total; status in a polite live region via aria-describedby. Give-rest/take-over buttons have aria-labels with the amount. Progress bar is aria-hidden; the numbers are in text. Minimizes errors: percentages dont add to 100, split bill rounding.

Which components pair with Split Allocator?