Amount
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
Add the component
npx ritla add amountAlso works with shadcn:
npx shadcn@latest add @ritla/amountOr 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
import { Amount } from "@/components/ui/amount";<Amount value={2450.75} decimals={3} unit="JOD" size="lg" />API reference
Amount
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | None | The value; negative shows in red with a minus. |
unit | ReactNode | None | Figma's Unit: a currency code, icon or another unit. |
unitAfter | boolean | false | The unit after the number (such as grams). |
decimals | number | 2 | Figma's Decimals: 3 for JOD and KWD. |
size | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "md" | Figma's Size. |
tone | "default" | "positive" | "negative" | None | Figma's Tone. |
showSign | boolean | false | Figma's Show sign. |
fraction | "small" | "dimmed" | "same" | None | Figma's Fraction. |
numerals | "latn" | "arab" | None | Western 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.750in Western ones. Figma draws Western digits in both languages. - Arabic typography
numeric-*styles, Semibold.