Balance
Keeps the number that matters most at the top, one tap from topping it up.
Examples
Hi, Maya
Hi, Maya
Low
falsedefault
true
States
rest
hover
focus
active
disabled
Usage
When to use it
- Use
- The header of an account screen, where the balance is always in sight.
- Use
- A sheet or settings page that shows the balance and leads to adding money.
- Use
- The balance is both a read-out and a way to add more.
- Not for
- One payment or fee. Use Amount.
- Not for
- A plan name or a count that is not a balance. Use Badge.
- Not for
- A static number with no action. Use plain text.
Rules
7 rules
- Must
- Give Balance an onClick (or render) that opens the add money flow; its label ends with Add money. Because its spoken label ends in Add money, so without onClick it promises an action that never runs.
- Should
- Set low under a limit your product chooses, before the person is stopped, not at zero.
- Must
- Pass value in major units (dollars); the chip adds the symbol, separators and cents. Because a string such as "$1,240" formats as $NaN, and cents read a hundred times too high.
- Never
- Restyle the chip with gradients or fills; it is lime with the subtle glow, amber when low. Because the switch to amber is the low warning, and a hand-set fill hides it.
- Should
- Show one Balance per screen; two can differ for a moment and look like a bug.
- Must
- Render a skeleton or nothing while the balance loads; never a stale or NaN number. Because an undefined value prints $NaN in the header, and a stale one invites a payment the account cannot cover.
- Should
- Use render to make it a link; do not nest a button in a link.
Accessibility
4 checks
- The button label is the spoken amount, then "running low" when low, then the action.
- The visible text is aria-hidden; the label covers it.
- Enter and Space run onClick; focus shows a 2px olive ring.
- Low also adds the word left, so color is not the only signal.
Edge cases
7 edge cases
- Very large balance
- Renders in full on one line; the pill grows.
- Zero
- Reads $0.00.
- Container narrower than the pill
- It overflows; it does not wrap or shrink.
- Right to left
- The wallet sits at the start and the number follows.
- Zoom 200%
- The pill keeps h-8 and text can clip; put it in a header that grows.
- Forced colors
- The glow drops and the chip takes a 1px ButtonText border.
- Missing balance
- A value that is not a number reads Unavailable; a numeric string such as "12.40" is read as the number. While loading, show a Skeleton.
API
5 props
valuenumberlowbooleandefaultfalsecurrencystringdefault'USD'actionLabelstringdefault'Add money'onClickfunction
Tokens
21 tokens
--accent- #e4f222
--on-accent- #0f0f0d
--glow-accent-from- #dbec1c
--glow-accent-to- #f6ff7c
--glow-accent-edge- rgb(255 255 255 / 0.7)
--glow-accent-bloom- rgb(255 255 255 / 0.28)
--glow-accent-cast- 112 120 20
--glow-accent-from-lit- #e4f42c
--glow-accent-to-lit- #faff9c
--glow-accent-edge-lit- rgb(255 255 255 / 0.9)
--glow-accent-from-press- #c8d915
--glow-accent-to-press- #e6f24a
--surface-2- #efeeea
--fg-disabled- #a6a49b
--warn-tint- #fff3d6
--warn-text- #8a5200
--radius-control- 999px
--text-sm- 14px
--weight-medium- 500
--dur-base- 200ms
--ease-out- cubic-bezier(0.16, 1, 0.3, 1)