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 (
setMessage("Transfer details are ready to review.")}>
Transfer money
}
/>
setMessage("Account ending in 7731 · USD")}>
Account details
}
/>
{message}
);
}
```
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.