The ArabicText.jsx component is a simple but powerful tool for handling Arabic text in React applications. By encapsulating RTL direction, font styling, and number formatting, it ensures consistent and accessible rendering of Arabic content across your application.
useEffect(() => // Check if Arabic font is supported const checkFont = async () => if ('fonts' in document) await document.fonts.ready; setFontLoaded(true); Arabic Text.jsx
// components/ArabicText.jsx import React from 'react'; import './ArabicText.css'; const ArabicText = ( children, size = 'medium', weight = 'normal', lineHeight = 'normal', className = '', ...props ) => The ArabicText
const sizeMap = small: '0.875rem', medium: '1rem', large: '1.25rem', xlarge: '1.5rem' ; and number formatting