Skip to content
Alea0.1
Pro
  1. Alea
  2. Components
  3. Data display
  4. Amount

Data display

Amount

Money with its direction: +$8,400.00 in green for money in, −$842.17 for money out, formatted for the reader's language and currency.

import { Amount } from '@alea/ui';

Examples

In and out

Positive is money in (green, with a plus), negative money out. icon adds the arrow.

In a table

End-aligned with tabular numbers, so the digits line up.

Tokens

The design tokens this component reads, with their value in the current theme. Override any of them to restyle it.

Color

  • --alea-status-success…
  • --alea-surface-raised…
  • --alea-text-muted…

Space

  • --alea-space-2…

Props

Amount props

Money with its direction: +$8,400.00 in green for money in, −$842.17 for money out, in the people's locale.

PropTypeDefaultDescription
valuerequirednumber-The amount: positive is money in, negative money out.
classNamestring-Extra class names for the root element.
colorInbooleantrueColor money in green. Default true.
currencystring'USD'ISO currency code. Default USD.
formatOptionsNumberFormatOptions-Number format options (merged with the currency).
iconboolean-Show the in/out arrow before it. Default false.

Specs

Generated from the source: the variants in the types, the states and tokens in the CSS, and the motion patterns that apply. The grids render the real component in both themes; the numbers are measured from the page.

Dark and light
Every color comes from theme tokens, so it follows data-theme (and presets like Graphite) on the page or any wrapper. Contrast is checked in both themes.
Styling hooks
.alea-amount.alea-amount-icon.alea-amount-value
Data attributes
data-colordata-dir=in

Accessibility

  • The sign is part of the text, so the direction never depends on color.
  • The arrow is decorative.

Do and don't

Do

  • Align amounts to the end in tables.
  • Pass the ISO currency of the account.

Don't

  • Don't color money out red: most rows are payments, and red means a problem.

In Figma

Amount with Direction (in, out) and Icon.

Tested with axe, keyboard and screen reader roles