Skip to main content

Arabic Number Utilities

Comprehensive utilities for formatting numbers in Arabic contexts. Includes Arabic-Indic numeral conversion (٠-٩), SAR currency formatting, and locale-aware number display. Perfect for GCC applications.

Preview

Western Numerals

Standard format

Number

1,234,567.89

Currency

9,999.99 SAR

Percentage

75.4%

Arabic-Indic Numerals

٠١٢٣٤٥٦٧٨٩

Number

١,٢٣٤,٥٦٧.٨٩

Currency

٩٬٩٩٩٫٩٩ ر.س

Percentage

٪٧٥٫٤

Installation

Copy the utility functions and component into your project:

Dependencies: No external dependencies required. Uses built-in Intl.NumberFormat API.

Utility Functions

Numeral Conversion

Convert between Western (0-9) and Arabic-Indic (٠-٩) numerals.

toArabicNumerals()

Input: 2025

٢٠٢٥

Input: 123.45

١٢٣.٤٥

toWesternNumerals()

Input: ٢٠٢٥

2025

Input: ١٢٣٫٤٥

123٫45

Currency Formatting (SAR)

Format numbers as Saudi Riyal currency with full locale support.

English Format

1,234.50 SAR

1,234.50 SAR

999,999.00 SAR

999,999.00 SAR

Arabic Format

١٬٢٣٤٫٥٠ ر.س

١٬٢٣٤٫٥٠ ر.س

٩٩٩٬٩٩٩٫٠٠ ر.س

٩٩٩٬٩٩٩٫٠٠ ر.س

Number Formatting

Format numbers with locale-specific separators and decimal points.

Standard

1,234,567.89

Arabic Locale

١٬٢٣٤٬٥٦٧٫٨٩

Arabic Numerals

١٬٢٣٤٬٥٦٧٫٨٩

Percentage Formatting

Format decimal numbers as percentages (0.15 = 15%).

75.5%

75.5%

23.67%

23.67%

Arabic: ٪٩٩٫٩

٪٩٩٫٩

Compact Number Formatting

Format large numbers in compact form (1K, 1M, 1B).

1.2K

1.2K

1.2M

1.2M

1.2B

1.2B

Arabic

١٫٢ مليون

Display Component

Use the ArabicNumber component for consistent number display in your UI.

Inline Usage

The product costs 499.99 SAR and is currently on sale with a 25.0% discount!

سعر المنتج ٤٩٩٫٩٩ ر.س ويوجد خصم ٪٢٥٫٠

Badge Variant

1,23499.99 SAR35.0%١,٢٣٤

Component Props

NameTypeDefaultDescription
value
Required
numberThe number to display.
format
"number" | "currency" | "percentage""number"Format type for the number.
useArabicNumerals
booleanfalseUse Arabic-Indic numerals (٠-٩) instead of Western (0-9).
locale
"en" | "ar""en"Locale for formatting (affects separators and symbols).
decimals
numberundefinedNumber of decimal places to display.
variant
"default" | "inline" | "badge""default"Visual style variant.
className
stringundefinedAdditional CSS classes.

Common Use Cases

E-commerce Prices

Statistics & Analytics

Discount Percentages

Compact Numbers

Accessibility

Arabic Number utilities follow accessibility best practices:

  • Tabular Numerals: Uses tabular-nums for consistent width and alignment.
  • Semantic HTML: Numbers are displayed in appropriate semantic elements.
  • High Contrast: Default styling maintains proper contrast ratios.
  • Screen Readers: Numbers are read correctly by screen readers in both formats.

RTL Considerations

These utilities are built with RTL support in mind:

  • Automatic Locale Detection: Component auto-detects Arabic locale for proper formatting.
  • Arabic-Indic Numerals: Full support for ٠١٢٣٤٥٦٧٨٩ numerals.
  • Proper Separators: Uses locale-appropriate thousands separators and decimal points.
  • Currency Symbols: Shows "ر.س" (Riyal symbol) in Arabic mode.
  • Percentage Format: Percentage symbol position adapts to locale (٪٧٥ vs 75%).

Related Components