MoneyNote
The "?" note beside a money figure, or a dotted-underlined term when you give it children. It opens a small popover (on click, hover or focus) with what the figure includes and excludes, read from the page's money-notes dictionary (MoneyNotesProvider). The popover closes on Escape and returns focus to the trigger.
import { MoneyNote } from '@ergasti/bricks';Examples
The "?" note
Press, hover or focus the "?" to see what a figure includes and excludes; Escape closes it. Wrap the page in MoneyNotesProvider with the server's dictionary.
Code
import { MoneyNote, MoneyNotesProvider, useLanguage } from '@ergasti/bricks';
import { moneyNotes } from './sample-data';
function Question() {
const language = useLanguage();
return (
<MoneyNotesProvider notes={moneyNotes(language)}>
<div style={{ display: 'flex', gap: 24, alignItems: 'center', paddingTop: 90 }}>
<span>Sales <MoneyNote figure="sales" /></span>
<span>Held <MoneyNote figure="wallet_held" amount="18450.00" /></span>
</div>
</MoneyNotesProvider>
);
}A dotted term and a figure
With children the trigger is the label itself; MoneyFigure pairs the term with its amount.
Code
import { Money, MoneyFigure, MoneyNote, MoneyNotesProvider, useLanguage } from '@ergasti/bricks';
import { moneyNotes } from './sample-data';
function Terms() {
const language = useLanguage();
return (
<MoneyNotesProvider notes={moneyNotes(language)}>
<div style={{ display: 'grid', gap: 10, paddingTop: 90 }}>
<MoneyNote figure="wallet_available"><b>Available</b></MoneyNote>
<MoneyFigure figure="wallet_balance" amount="61840.00" />
<MoneyFigure figure="wallet_topped_up" amount="287800.00" label="Total top-ups" />
<Money value="43390.00" />
</div>
</MoneyNotesProvider>
);
}Variants
A note that wraps a label can be drawn 'term' (dotted underline, the default), 'plain' (plain text that still opens the note) or 'icon' (plain text with the small "?" after it). BricksProvider moneyNoteStyle sets one look for a whole subtree.
Code
import { MoneyNote, MoneyNotesProvider, useLanguage } from '@ergasti/bricks';
import { moneyNotes } from './sample-data';
function Variants() {
const language = useLanguage();
return (
<MoneyNotesProvider notes={moneyNotes(language)}>
<div style={{ display: 'grid', gap: 10, paddingTop: 70 }}>
<MoneyNote figure="wallet_available" variant="term">Available (term)</MoneyNote>
<MoneyNote figure="wallet_available" variant="plain">Available (plain)</MoneyNote>
<MoneyNote figure="wallet_available" variant="icon">Available (icon)</MoneyNote>
</div>
</MoneyNotesProvider>
);
}Props
Prop
Type
Labels
Every word this component draws, in both languages. Override one per component and language with BricksProvider labels under the key moneyNote, or with the component's own prop where it has one. A {name} is a value the component fills in.
| Key | English | Arabic |
|---|---|---|
open | {label}, what's included | {label}، إيه اللي محسوب فيه |
term | {shown2} ({label}), what's included | {shown2} ({label})، إيه اللي محسوب فيه |
includes | Includes | يشمل |
excludes | Doesn’t include | لا يشمل |
Design guidance
How the BRICKS design system uses MoneyNote. Written in docs/content/components/MoneyNote.md; the props above are read from the code, which wins where the two disagree.
The "?" explanation attached to every money figure: a dotted term (or a small "?" button) that opens a short note on what the figure includes and excludes; wrap the label of any money value in it.
It implements Rule 2 of the Money Consistency Contract: every money figure says what it counts. The note text comes from one dictionary (affiliate::money, the bootstrap's money_notes), given once to BricksProvider moneyNotes or MoneyNotesProvider; a surface only names the figure key. The popover is a real non-modal dialog, portalled so table overflow cannot clip it, placed above the trigger (below when there is no room), kept inside a 16px viewport gutter, in LTR or RTL. MoneyFigure is the ready-made label + "?" + amount.
Anatomy
- Wrapper:
span.kit-note(kit-note--term | plain | iconwhen it wraps a label). - Trigger, one of:
- Term:
button.kit-term, the label with a 1.5px dotted underline (the mock's.term); - Plain:
button.kit-term.kit-term--plain, the label without underline; - Icon:
.kit-note-llabel +button.kit-note-btn, a 16px circled "?" in a 24px button.
- Term:
- Popover:
span.kit-note-pop[role=dialog], fixed, 240px, ink background:- Title
.kit-note-t: the dictionary label, and the formattedamountwhen given; - "Includes" heading + text; "Doesn't include" heading + text.
- Title
MoneyFigure: .kit-money = .kit-money-l (MoneyNote term with the dictionary label) + .kit-money-v (LTR tabular amount).
Variants
| Prop value | Look | When to use |
|---|---|---|
variant="term" (default) | Dotted underline | Labels of tiles, KPI cards, key-value rows. |
variant="plain" | Plain text, still a button | Where the mock draws the label plain ("Topped up in total"). |
variant="icon" | Label then a small "?" | Dense places where an underline is noisy. |
no children | The small "?" alone | Table headers (the header text stays first in the name). |
BricksProvider moneyNoteStyle | Sets the default variant app-wide | A product-wide decision on the look. |
States
| State | Trigger |
|---|---|
| Closed | default. |
| Open by hover | mouse enters; closes on leave unless clicked. |
| Open by focus | keyboard focus; closes on blur outside. |
| Open by click / tap | toggles; stays open until outside pointer, Escape, scroll or resize. |
| Above / below | above when ≥ 180px of room up to the clipping ancestor, else below. |
| With amount | amount adds the formatted figure to the title. |
| Missing note | a key absent from the dictionary renders the label only (no button). |
| Hover (icon) | the "?" turns --color-accent-dark. |
Types
MoneyFigure: figure (required), amount: string (required, 2-dp), label?: string (overrides the dictionary label), className?, money?: MoneyDisplay (slot moneyFigure.amount), language?.
MoneyNotesProvider: notes: MoneyNotes, children; overrides the provider's notes below it. useMoneyLabel() returns a function that gives a figure's dictionary label.
Usage
// App root: the dictionary, once
<BricksProvider preset={trndrPreset} language={lang} moneyNotes={bootstrap.money_notes}>
<App />
</BricksProvider>// A Home metric tile
<Tile size="metric" tone="lime" label={<MoneyNote figure="sales">Sales</MoneyNote>}
value={<Money value="312400.00" compact />} delta={<Delta value={12} context="vs last month" />} />// Payments › payout drawer read-outs
<MoneyFigure figure="wallet_balance" amount="61840.00" />
<MoneyFigure figure="wallet_held" amount="18450.00" />// Table header: the bare "?" after the header text
type Row = { id: number; sales: string };
const columns: DataColumn<Row>[] = [
{ key: 'sales', label: <>Sales <MoneyNote figure="creator_sales" /></>, align: 'end', render: (r) => <Money value={r.sales} /> },
];Where it appears
- In the v3 mocks: the dotted
.termlabels on Brand › Home (wallet hero, metric tiles) (BrandHome), Brand › Payments (wallet hero, ledger, health card, payout drawer) (BrandWallet), Coupons, Analytics, Find creators ("Sold · 90 days"), group cards; PR Portal › brand detail, creator drawer, challenge cards, leaderboard, tier ladder. - Library additions: the money contract adds a "?" to every money figure, including ones the mocks draw plain ("Topped up in total"); bundle cards and fraud cases are library only.
- Built into
HeroCard,Tile,KpiCardlabels,KeyValue(figure),RowList/DataTablecolumns (figure).
Guidelines
Do
- Name a figure key; never write the explanation inline.
- Use the term variant on labels and the bare "?" in table headers.
- Pass
amountwhen the figure is not visible next to the trigger.
Don't
- Don't put a MoneyNote inside another button (a clickable
KpiCardalready lays its button over the card so the label can hold one). - Don't show a money figure without one.
RTL and Arabic
- Placement uses physical coordinates and the trigger's
dir, so the popover aligns to the start edge in RTL. - Copy: "يشمل" / "لا يشمل"; the name reads "المبيعات، إيه اللي محسوب فيه". Amounts stay LTR (
kit-num). - The popover inherits the console font (Cairo in Arabic) from the layout root it portals into.
Tokens
--ink, --color-accent-dark, --color-text-muted, --color-text-strong-neutral, --focus-ring, --radius-xs, --font-family-sans, --font-family-display, --lh-ar, --min-touch-target.
Accessibility
- The trigger is a
<button>witharia-expandedandaria-controls; its name starts with the visible words: "Sales, what's included" (or "Price (Bundle price), what's included"). - The popover is
role="dialog"named by its title; Escape closes it and returns focus without reopening. - Opens on hover and focus as well as click, so pointer, keyboard and touch users all reach it.
- Inside a modal it portals into the dialog, keeping the focus trap; on touch tiers (≤1024px) the 24px "?" gets a 44px hit area; on desktop it stays 24px, and a term gets a 24px-tall hit area.
Found in the source
- Roles in the markup:
dialog. - ARIA attributes set:
aria-label,aria-expanded,aria-controls,aria-hidden,aria-labelledby. - It moves focus in code.
- Its tests cover: “is a real button with an aria-label naming the figure, closed by default”; “opens on Enter and on Space; Escape closes it and returns focus to the button”; “inside a drawer, renders into the drawer (so its focus trap and inert handling still hold), not the table”; “shows the dictionary label, a note button and the amount dir=ltr, tabular”; “wraps the label: the label is the trigger, named for its figure”; “opens on keyboard focus, closes on blur; Escape closes without the returned focus reopening it”.
Read from the component's source and tests. See Accessibility for the patterns the library follows.
Related
Term: the same dotted term for non-money words ("Commission rate", "Orders").Money: formats the amount itself.MoneyFigure: label + "?" + amount in one.
See also: useBricks · useMoneyDisplay · useLanguage · MoneyNotesProvider · Avatar · AvatarStack · Button · ButtonLink
Source
src/kit/MoneyNote.tsx (line 104) on GitHub.