Skip to content

Amount

Beta
Get Ritla UI

Money with its currency, an optional sign and decimals, in the reader's digits.

Preview

Mirrored is the same English content laid out right to left: it separates a mirroring bug from a translation one.

PreviewCode
EnglishMirroredArabic
LTR →

Installation

  1. Add the component

    npx ritla add amount

    Also works with shadcn: npx shadcn@latest add @ritla/amount

  2. Or copy by hand

    Installing by hand copies the component's source into your project. The source comes with a Ritla UI license, so the CLI is the short way to the same files.

Usage

amount.tsx
import { Amount } from "@/components/ui/amount";<Amount value={2450.75} decimals={3} unit="JOD" size="lg" />

API reference

Amount

PropTypeDefaultDescription
valuenumberNoneThe value; negative shows in red with a minus.
unitReactNodeNoneFigma's Unit: a currency code, icon or another unit.
unitAfterbooleanfalseThe unit after the number (such as grams).
decimalsnumber2Figma's Decimals: 3 for JOD and KWD.
size"sm" | "md" | "lg" | "xl" | "2xl" | "3xl""md"Figma's Size.
tone"default" | "positive" | "negative"NoneFigma's Tone.
showSignbooleanfalseFigma's Show sign.
fraction"small" | "dimmed" | "same"NoneFigma's Fraction.
numerals"latn" | "arab"NoneWestern or Arabic-Indic digits. Default: what RitlaProvider sets.

Accessibility

ARIA

  • The amount reads in full with its unit and sign.

Arabic and RTL notes

Mirrors

  • The unit stays at the amount's start: on the right in Arabic.

Does not mirror

  • The number is isolated left to right.
Numerals
The amount follows the numerals setting like every other amount on the page: ٢٬٤٥٠٫٧٥٠ in Arabic-Indic digits with their own separators, 2,450.750 in Western ones. Figma draws Western digits in both languages.
Arabic typography
numeric-* styles, Semibold.