Currency

Format monetary values with proper symbols and locale support.

formatCurrency

Formats numbers as currency with proper symbols, thousands separators, and decimal places based on locale and currency standards.

import { formatCurrency } from "@tilt-legal/cubitt-components/utilities/formatters";

formatCurrency(1234.56); // "$1,234.56" (AUD)
formatCurrency(1234.56, { currency: "USD" }); // "$1,234.56"
formatCurrency(1234.56, { currency: "EUR" }); // "€1,234.56"
formatCurrency(1234.56, { decimals: 0 }); // "$1,235"
PropertyTypeDefaultDescription
currencystring'AUD'Currency code (ISO 4217)
localestring'en-AU'Locale for formatting
decimalsnumber-Number of decimal places
display'symbol' | 'narrowSymbol' | 'code' | 'name''symbol'Currency display mode

formatCurrencyCompact

Formats large currency amounts using compact notation (K, M, B, T) for easier reading and space efficiency.

import { formatCurrencyCompact } from "@tilt-legal/cubitt-components/utilities/formatters";

formatCurrencyCompact(1500000); // "$1.5M"
formatCurrencyCompact(1234567, { decimals: 0 }); // "$1M"
formatCurrencyCompact(1500, { notation: "long" }); // "$1.5 thousand"
PropertyTypeDefaultDescription
currencystring'AUD'Currency code (ISO 4217)
localestring'en-AU'Locale for formatting
decimalsnumber1Number of decimal places
display'symbol' | 'narrowSymbol' | 'code' | 'name''symbol'Currency display mode
notation'short' | 'long''short'Compact notation type

formatCurrencyRange

Formats a range of currency values with consistent formatting, useful for price ranges and salary bands.

import { formatCurrencyRange } from "@tilt-legal/cubitt-components/utilities/formatters";

formatCurrencyRange(100, 200); // "$100.00 - $200.00"
formatCurrencyRange(1000, 5000, { compact: true }); // "$1K - $5K"
formatCurrencyRange(100, 200, { decimals: 0 }); // "$100 - $200"
PropertyTypeDefaultDescription
currencystring'AUD'Currency code (ISO 4217)
localestring'en-AU'Locale for formatting
decimalsnumber-Number of decimal places
display'symbol' | 'narrowSymbol' | 'code' | 'name''symbol'Currency display mode
compactbooleanfalseUse compact notation

On this page