terra vidhal

Expense Splitter

Component

About

A shared bill splitter with per-line assignments, animated per-person shares, tip and tax controls, payer selection, settlement instructions, keyboard-friendly toggles and a reversible settled state.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Expense Splitter to your project and fits it to your theme.

Code

How Expense Splitter is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import { ExpenseSplitter, type SplitItem, type SplitPerson } from "@/components/ui/expense-splitter";

const PEOPLE: SplitPerson[] = [
  { id: "mara", name: "Mara Ellison", tone: "sky" },
  { id: "theo", name: "Theo Nakamura", tone: "violet" },
  { id: "priya", name: "Priya Raman", tone: "amber" },
  { id: "jonas", name: "Jonas Weber", tone: "emerald" },
];

const ITEMS: SplitItem[] = [
  {
    id: "table",
    label: "Shared starters and small plates",
    amount: 68,
    assignedTo: ["mara", "theo", "priya", "jonas"],
  },
  {
    id: "mains",
    label: "Four main courses",
    amount: 124,
    assignedTo: ["mara", "theo", "priya", "jonas"],
  },
  {
    id: "wine",
    label: "Two bottles of house red",
    amount: 56,
    assignedTo: ["mara", "theo"],
  },
  {
    id: "dessert",
    label: "Dessert tasting board",
    amount: 32,
    assignedTo: ["priya", "jonas"],
  },
  {
    id: "coffee",
    label: "Coffee and tea",
    amount: 18,
    assignedTo: ["mara", "priya", "jonas"],
  },
  {
    id: "service",
    label: "Private room fee",
    amount: 40,
    assignedTo: ["mara", "theo", "priya", "jonas"],
  },
];

export default function ExpenseSplitterDemo() {
  return (
    <main className="flex min-h-screen w-full items-center justify-center bg-background px-4 py-12 sm:px-6">
      <ExpenseSplitter
        people={PEOPLE}
        items={ITEMS}
        taxRate={8.25}
        title="Dinner for four"
        description="A shared dinner with a few uneven orders. Assign each line, add a tip and settle without a spreadsheet."
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Gravity Stars Background

    Gravity Stars Background

    16
  • Audio Waveform

    Audio Waveform

    13
  • Topographic Lines

    Topographic Lines

    12
  • Notification Center

    Notification Center

    11
  • Booking Calendar

    Booking Calendar

    11
  • Spotlight Card

    Spotlight Card

    11
  • Command Palette

    Command Palette

    9
  • Kpi Counter

    Kpi Counter

    9

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.