SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

Ledger

A statement of money movements grouped by day.

View code
tsx
<Ledger>
	<Ledger.Day title="Today" total={<Amount value={-6140} currency="EUR" />}>
		<Ledger.Entry mark={<Mark letters="CL" />} title="Café Lumen" meta="Eating out · Pending"
			amount={<Amount value={-340} currency="EUR" sign="ledger" />} href="?tx=1" muted />
		<Ledger.Entry mark={<Mark letters="TR" />} title="Tasca do Ribeiro" meta="Eating out · Split 3 ways"
			amount={<Amount value={-5800} currency="EUR" sign="ledger" />}
			amountMeta={<>You: <Amount value={-1933} currency="EUR" /></>} href="?tx=2" current />
	</Ledger.Day>
	<Ledger.Day title="Yesterday">
		<Ledger.Entry mark={<Mark letters="AN" />} title="Atelier Norte" meta="Income"
			amount={<Amount value={210000} currency="EUR" sign="ledger" />} href="?tx=3" />
	</Ledger.Day>
</Ledger>

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { Ledger } from "@sdxc/ui/finance";

Renders the statement as a column of day groups.

Composition

The parts the component publishes, each a static property of the host.

  • Ledger
  • Ledger.DayRenders one day: a sticky heading row with the day's total at its end, over its entries.
  • Ledger.EntryRenders one movement.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
childrenRemixNodeYesLedger.Day groups, newest first.

Also accepts everything in TagProps<"div">.

Ledger.Day

PropTypeRequiredDescription
titleRemixNodeYesThe day's heading as the reader says it: "Today", "Yesterday", "Mon 16 Nov".
totalRemixNodeNoThe day's net movement, usually an Amount; omitted on a day of one entry.
childrenRemixNodeYesLedger.Entry rows, newest first.

Also accepts everything in Omit<TagProps<"section">, "title">.

Ledger.Entry

PropTypeRequiredDescription
markRemixNodeNoThe merchant or person: a logo, an Avatar or an icon tile, about 2.5rem square.
titleRemixNodeYesWho the money went to or came from.
metaRemixNodeNoA quiet second line: the category, the account, a time or "Pending".
amountRemixNodeYesThe amount, usually an Amount with sign="ledger".
amountMetaRemixNodeNoA quiet line under the amount: the original currency, a split share, a note mark.
hrefstringNoThe record's address; the whole row becomes one link to it.
currentbooleanNoMarks the row whose record is open beside the list.
mutedbooleanNoDraws the row muted, for a pending or declined movement.

Also accepts everything in Omit<TagProps<"li">, "title">.

@sdxc/ui

Can’t find it? Contact us