Components
Money
NativeCurrency amounts, a private account balance and daily transaction groups.
Studio operating
Checking · ending 2048
- Available
- $23,350.75
- Pending
- $1,500.00
Tax savings
Savings · ending 7731
- Available
- Pending
- Rent and studio61%$1,200.00
- Software16%$312.40
- Supplies10%$186.50
- Travel7%$142.00
- Meals5%$96.80
- Other1%$24.00
Today, November 14Net +$3,113.50
- Northline StudioInvoice payment · INV-2026-042+$3,200.00Money in
- Nook MarketStudio suppliesPending-$86.50Money out
Yesterday, November 13Net -$1,200.00
- Workspace CollectiveMonthly studio rent-$1,200.00Money out
- Cloud storageSoftware subscriptionFailed-$24.00Money out
Installation
npx nook-ui@latest add moneyPrompt
Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.
Short. For assistants that can run commands in your project.
Add the Nook "Money" component to this project, exactly as Nook ships it.
Currency amounts, a private account balance and daily transaction groups.
Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add money`. It writes `components/ui/money.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/money.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:
```tsx
"use client";
import * as React from "react";
import { Button } from "@/components/ui/button";
import { BalanceCard, SpendingBreakdown, TransactionList } from "@/components/ui/money";
export default function MoneyDefault() {
const [message, setMessage] = React.useState("");
return (
<div className="grid w-full max-w-2xl gap-6">
<div className="grid gap-4 md:grid-cols-2">
<BalanceCard
tone="brand"
accountName="Studio operating"
accountNote="Checking · ending 2048"
balance={24850.75}
available={23350.75}
pending={1500}
trend={[19200, 20400, 19800, 21500, 22100, 23900, 24850]}
change={{ value: 1240.5, percent: 5.3, period: "this month" }}
actions={
<Button variant="secondary" onClick={() => setMessage("Transfer details are ready to review.")}>
Transfer money
</Button>
}
/>
<BalanceCard
accountName="Tax savings"
accountNote="Savings · ending 7731"
balance={8420}
available={8420}
pending={0}
defaultHidden
change={{ value: -260, percent: -3, period: "this month" }}
actions={
<Button variant="outline" onClick={() => setMessage("Account ending in 7731 · USD")}>
Account details
</Button>
}
/>
</div>
<p role="status" className="min-h-5 text-sm text-muted-foreground">
{message}
</p>
<SpendingBreakdown
title="Spending in November"
categories={[
{ label: "Rent and studio", amount: 1200 },
{ label: "Software", amount: 312.4 },
{ label: "Supplies", amount: 186.5 },
{ label: "Travel", amount: 142 },
{ label: "Meals", amount: 96.8 },
{ label: "Fees", amount: 24 },
]}
/>
<TransactionList
transactions={[
{ id: "t1", day: "Today, November 14", name: "Northline Studio", category: "Invoice payment · INV-2026-042", amount: 3200 },
{ id: "t2", day: "Today, November 14", name: "Nook Market", category: "Studio supplies", amount: -86.5, status: "pending" },
{ id: "t3", day: "Yesterday, November 13", name: "Workspace Collective", category: "Monthly studio rent", amount: -1200 },
{ id: "t4", day: "Yesterday, November 13", name: "Cloud storage", category: "Software subscription", amount: -24, status: "failed" },
]}
/>
</div>
);
}
```
API
- `Money`: An Intl.NumberFormat amount in major currency units. formatMoney is also exported for client-side labels.
- `value` (`number`): Amount in major units, including negative values.
- `currency / locale` (`string`, default "USD" / "en-US"): Explicit currency and locale keep server and client formatting consistent.
- `compact / showSign` (`boolean`, default false): Abbreviate large amounts or show a plus sign for positive amounts.
- `negativeClassName` (`string`): Optional tone for negative amounts; the minus sign is always kept.
- `BalanceCard`: Account balance, visibility toggle, available and pending balances, and an actions slot. Nothing is persisted by the component.
- `accountName / balance` (`string / number`): Account heading and balance in major units.
- `available / pending` (`number`): Optional secondary amounts; masked with the main balance.
- `hidden / defaultHidden / onHiddenChange` (`boolean / boolean / (hidden: boolean) => void`): Controlled or local visibility. Apps may persist the controlled state themselves.
- `actions` (`ReactNode`): Optional transfer or account action buttons.
- `accountNote` (`string`): A short line under the name, such as the last digits.
- `trend` (`number[]`): Recent balances, oldest first, drawn as a small line.
- `change` (`{ value; percent?; period? }`): How the balance changed. Shown with a triangle and a sign.
- `tone` (`"default" | "brand"`, default "default"): `brand` fills the card with the brand color.
- `AmountChange`: A rise or fall in money. A triangle and a sign carry the direction, never color alone.
- `value` (`number`): The change in major units. Its sign gives the direction.
- `percent` (`number`): Optional percent shown beside it.
- `period` (`string`): What it is measured over, such as "this month".
- `CurrencyInput`: An amount field with the currency symbol. It accepts only digits and one decimal mark, and tidies to two decimals on blur.
- `value / defaultValue` (`number | null`): Controlled or initial amount in major units.
- `onValueChange` (`(value: number | null) => void`): Called while typing, with null for an empty field.
- `min / max` (`number`): Limits. Outside them the field is marked invalid; explain why next to it.
- `currency / locale` (`string`, default "USD" / "en-US"): Symbol and decimal mark.
- `SpendingBreakdown`: A bar of square cells split by category, with a legend that names every share and amount. Five categories get a color; the rest join Other.
- `categories` (`{ label; amount }[]`): Where the money went.
- `title` (`string`): What is being split, for screen readers.
- `TransactionList`: Groups transactions by app-supplied day labels and retains first-seen day order.
- `transactions` (`Transaction[]`): Rows with id, day, name, category, amount, optional icon and completed/pending/failed status.
- `onSelect` (`(transaction: Transaction) => void`): Makes each row a keyboard-accessible action.
- `currency / locale` (`string`): Formatting for every row.
Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: Amounts retain their minus or plus sign. The visibility button announces whether the balance is hidden and uses square dots to mask every amount. Selectable transactions are native buttons.
Done when the component renders like the example in light and dark mode and the project type-checks.Usage
"use client";
import * as React from "react";
import { Button } from "@/components/ui/button";
import { BalanceCard, SpendingBreakdown, TransactionList } from "@/components/ui/money";
export default function MoneyDefault() {
const [message, setMessage] = React.useState("");
return (
<div className="grid w-full max-w-2xl gap-6">
<div className="grid gap-4 md:grid-cols-2">
<BalanceCard
tone="brand"
accountName="Studio operating"
accountNote="Checking · ending 2048"
balance={24850.75}
available={23350.75}
pending={1500}
trend={[19200, 20400, 19800, 21500, 22100, 23900, 24850]}
change={{ value: 1240.5, percent: 5.3, period: "this month" }}
actions={
<Button variant="secondary" onClick={() => setMessage("Transfer details are ready to review.")}>
Transfer money
</Button>
}
/>
<BalanceCard
accountName="Tax savings"
accountNote="Savings · ending 7731"
balance={8420}
available={8420}
pending={0}
defaultHidden
change={{ value: -260, percent: -3, period: "this month" }}
actions={
<Button variant="outline" onClick={() => setMessage("Account ending in 7731 · USD")}>
Account details
</Button>
}
/>
</div>
<p role="status" className="min-h-5 text-sm text-muted-foreground">
{message}
</p>
<SpendingBreakdown
title="Spending in November"
categories={[
{ label: "Rent and studio", amount: 1200 },
{ label: "Software", amount: 312.4 },
{ label: "Supplies", amount: 186.5 },
{ label: "Travel", amount: 142 },
{ label: "Meals", amount: 96.8 },
{ label: "Fees", amount: 24 },
]}
/>
<TransactionList
transactions={[
{ id: "t1", day: "Today, November 14", name: "Northline Studio", category: "Invoice payment · INV-2026-042", amount: 3200 },
{ id: "t2", day: "Today, November 14", name: "Nook Market", category: "Studio supplies", amount: -86.5, status: "pending" },
{ id: "t3", day: "Yesterday, November 13", name: "Workspace Collective", category: "Monthly studio rent", amount: -1200 },
{ id: "t4", day: "Yesterday, November 13", name: "Cloud storage", category: "Software subscription", amount: -24, status: "failed" },
]}
/>
</div>
);
}Examples
Sending money
The amount field only takes numbers and tidies itself when you leave it.
Number formats
- Standard
- $1,234.50
- Compact
- $1.3M
- Euro, German format
- 1.234,50 €
- Yen
- ¥98,000
- Refund
- -$42.90
- Deposit with sign
- +$500.00
Changes over time
- Revenue Up +$4,820.00(+12.4%)vs last month
- Refunds Down -$310.00(-8.0%)vs last month
- Ad spend (lower is better) Down -$640.00vs last month
Hidden and negative balance
Tax savings
Savings · ending 7731
Overdraft account
Checking · ending 1190
- Available
- $0.00
- Pending
- $85.00
Props
Money
An Intl.NumberFormat amount in major currency units. formatMoney is also exported for client-side labels.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | – | Amount in major units, including negative values. |
| currency / locale | string | "USD" / "en-US" | Explicit currency and locale keep server and client formatting consistent. |
| compact / showSign | boolean | false | Abbreviate large amounts or show a plus sign for positive amounts. |
| negativeClassName | string | – | Optional tone for negative amounts; the minus sign is always kept. |
BalanceCard
Account balance, visibility toggle, available and pending balances, and an actions slot. Nothing is persisted by the component.
| Prop | Type | Default | Description |
|---|---|---|---|
| accountName / balance | string / number | – | Account heading and balance in major units. |
| available / pending | number | – | Optional secondary amounts; masked with the main balance. |
| hidden / defaultHidden / onHiddenChange | boolean / boolean / (hidden: boolean) => void | – | Controlled or local visibility. Apps may persist the controlled state themselves. |
| actions | ReactNode | – | Optional transfer or account action buttons. |
| accountNote | string | – | A short line under the name, such as the last digits. |
| trend | number[] | – | Recent balances, oldest first, drawn as a small line. |
| change | { value; percent?; period? } | – | How the balance changed. Shown with a triangle and a sign. |
| tone | "default" | "brand" | "default" | `brand` fills the card with the brand color. |
AmountChange
A rise or fall in money. A triangle and a sign carry the direction, never color alone.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | – | The change in major units. Its sign gives the direction. |
| percent | number | – | Optional percent shown beside it. |
| period | string | – | What it is measured over, such as "this month". |
CurrencyInput
An amount field with the currency symbol. It accepts only digits and one decimal mark, and tidies to two decimals on blur.
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | number | null | – | Controlled or initial amount in major units. |
| onValueChange | (value: number | null) => void | – | Called while typing, with null for an empty field. |
| min / max | number | – | Limits. Outside them the field is marked invalid; explain why next to it. |
| currency / locale | string | "USD" / "en-US" | Symbol and decimal mark. |
SpendingBreakdown
A bar of square cells split by category, with a legend that names every share and amount. Five categories get a color; the rest join Other.
| Prop | Type | Default | Description |
|---|---|---|---|
| categories | { label; amount }[] | – | Where the money went. |
| title | string | – | What is being split, for screen readers. |
TransactionList
Groups transactions by app-supplied day labels and retains first-seen day order.
| Prop | Type | Default | Description |
|---|---|---|---|
| transactions | Transaction[] | – | Rows with id, day, name, category, amount, optional icon and completed/pending/failed status. |
| onSelect | (transaction: Transaction) => void | – | Makes each row a keyboard-accessible action. |
| currency / locale | string | – | Formatting for every row. |
Accessibility
Amounts retain their minus or plus sign. The visibility button announces whether the balance is hidden and uses square dots to mask every amount. Selectable transactions are native buttons.
Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.