---
title: "ExpenseTracker"
description: "Spend by category on three bases, with polarity derived per row."
canonical: "https://lopifi.com/components/expense-tracker"
---

# ExpenseTracker

> Spend by category on three bases, with polarity derived per row.

Source: https://lopifi.com/components/expense-tracker
Part of: Lopifi — Your VC tech stack partner (https://lopifi.com)

---

- **Family:** Metrics & analysis — 
- **Status:** Implemented
- **Spec:** https://lopifi.com/docs/catalog/metrics-and-analysis

## Install

```bash
npx shadcn@latest add @lopifi/theme
npx shadcn@latest add @lopifi/expense-tracker
```

## Specification

Spend by category on three bases (actual, budget, variance), because they're the same categories
asked three questions, and nobody reads a nine-column grid past the third column.

**Every row carries a polarity, and the component derives it.** More spend isn't good news: under
budget is favorable, over budget isn't. A grid that paints a rising cost green tells the reader
the opposite of the truth.

Polarity describes the figure *as stored*, not the concept behind it, and that's the easiest thing
here to get backwards. This system holds costs as negatives, so a heavier month moves **down** and
the row wants `standard`. A model that holds the same costs as positive magnitudes wants
`inverted`. `ExpenseTracker` takes a `sign` and works it out, so the caller doesn't have to reason
about a storage convention to get the colors right.

Committed-but-unbilled sits beside the total, never inside it. A purchase order isn't an expense.
Accruing it silently is a cutoff error, and hiding it is how a category with six figures of open
POs looks under budget until the invoices land.

The movers list ranks by amount, not percentage. A line that doubled from 400 to 800 isn't the
story of a month where another went from 180,000 to 240,000.

## Rules this component obeys

Money is minor units, never floats. `null` is not `0` and neither is redacted. Negatives render in accounting parentheses with the parenthesis column reserved on both sides. Debit and credit are two columns. Per-currency decimal places. Polarity is explicit — up is not always good. Every figure states its period, entity, currency, basis and as-of.
