RTL
Configure Zenos for Arabic, Hebrew, Persian, and mixed-direction product interfaces.
Zenos supports right-to-left interfaces through native HTML direction, logical layout utilities, and the Direction component for interactive Base UI behavior. Set both layers: dir controls browser layout and text flow, while DirectionProvider keeps keyboard navigation, positioning, sliders, menus, and portalled surfaces aligned with that direction.
مرحباً بعودتك
أدخل بياناتك للوصول إلى مساحة العمل.
تذكرني
Configure the application root
Section titled “Configure the application root”Set the document language and direction as early as possible, ideally in the server-rendered root element. Then wrap the application with Zenos’ provider.
import { DirectionProvider } from "@zentara-co/zenos-ui"; export function App({ children }: { children: React.ReactNode }) { return <DirectionProvider direction="rtl">{children}</DirectionProvider>;}<html lang="ar" dir="rtl"></html>Use direction="ltr" | "rtl" on DirectionProvider. The default is ltr. Zenos does not change document.documentElement for you because applications own language selection, SSR output, persistence, and hydration.
Scope a mixed-direction region
Section titled “Scope a mixed-direction region”An application can keep its document LTR while rendering an RTL conversation, preview, or embedded workflow. Keep the DOM attribute and provider on the same boundary:
<div lang="he" dir="rtl"> <DirectionProvider direction="rtl"> <MessageThread /> </DirectionProvider></div>Plain text can use dir="auto" when its direction is unknown, but interactive component trees need an explicit provider direction.
Write direction-independent layouts
Section titled “Write direction-independent layouts”Prefer logical language in application styles and component composition:
| Physical | Logical equivalent |
|---|---|
left-* / right-* | start-* / end-* |
ml-* / mr-* | ms-* / me-* |
pl-* / pr-* | ps-* / pe-* |
border-l / border-r | border-s / border-e |
text-left / text-right | text-start / text-end |
Physical values are still correct when the meaning is genuinely physical—for example, a comparison handle anchored to the left side of an image. Zenos’ Sheet accepts inline-start and inline-end for language-aware edges while retaining left and right for explicitly physical placement.
AppShell places Side Nav at inline start and opens its compact navigation sheet from that same edge. Table headings, toggles, switches, pagination, breadcrumbs, submenu indicators, gallery controls, and horizontal resize keyboard behavior also follow direction.
Directional icons
Section titled “Directional icons”Mirror arrows and chevrons whose meaning is backward, forward, expand, or collapse. Do not mirror logos, checkmarks, media controls, or icons that depict a physical object.
<Button endIcon={<ArrowRightIcon className="rtl:rotate-180" />}>Continue</Button>Built-in Zenos pagination, breadcrumb, menu, and lightbox chevrons mirror automatically. Consumer-provided icons remain under application control because Zenos cannot infer their meaning.
Portals and overlays
Section titled “Portals and overlays”Keep DirectionProvider above dialogs, menus, selects, popovers, tooltips, and other portalled components. Base UI uses the context to resolve alignment and keyboard behavior even when the popup is mounted outside the local DOM subtree. The document-level dir attribute ensures logical CSS and text alignment also reach the portal container.
Use logical Sheet sides for localized applications:
<Sheet.Content side="inline-end"> <Sheet.Title>Settings</Sheet.Title></Sheet.Content>Fonts and content
Section titled “Fonts and content”Choose a font family with complete glyph coverage for the target language. Keep user-entered identifiers, email addresses, URLs, code, and numbers in their natural direction; use a nested dir="ltr" or CSS unicode-bidi treatment only for the specific content that needs it.
Translated labels are often longer than their English equivalents. Test narrow containers, zoom, validation messages, loading states, and mixed Arabic or Hebrew text with Latin product names.
Testing checklist
Section titled “Testing checklist”- Render representative pages with
dir="rtl"andDirectionProvider direction="rtl". - Verify arrow-key behavior for sliders, resizable panels, galleries, tabs, menus, and composite controls.
- Open every portalled surface and confirm alignment, entry motion, and close controls.
- Check that Side Nav, leading and trailing icons, table alignment, and form labels follow inline start.
- Test mixed-direction content, long translations, keyboard focus order, screen-reader labels, and browser zoom.
- Run accessibility and visual-regression coverage in both LTR and RTL for critical product flows.