RTL
KinetixUI components mirror correctly under dir="rtl" — this is a
CSS-and-context concern in the component library itself, not something
this docs site (English-only, always dir="ltr") demonstrates live.
In progress. RTL is being converted incrementally, one component at a
time. Files in packages/ui/src/components that already use
direction-relative (logical) classes are locked in by pnpm check:rtl in
CI, which blocks regressions and reports how many files still use
physical-direction classes (pl-, right-, …) and haven't been converted
yet — see RTL.md at the repo root for the current,
authoritative per-file list.
The two pieces#
A component mirroring under RTL needs both of these — either alone isn't enough:
- CSS logical properties. Component source uses direction-relative
Tailwind utilities (
ps-/pe-,ms-/me-,start-/end-,border-s/border-e,text-start/text-end) instead of physical ones (pl-/pr-,left-/right-,text-left/text-right). - Radix direction context. Every Radix primitive KinetixUI builds on
(
Select,DropdownMenu,Popover,Tooltip,ContextMenu,Menubar,NavigationMenu,HoverCard, …) reads direction from Radix's ownDirectionContext, not from the ambientdirattribute. With no provider in the tree it defaults hard to"ltr"and stamps that onto its own portaled content — so aSelect's checkmark, aDropdownMenu's items, aPopover's offset math stay LTR even under<html dir="rtl">unless the app is wrapped inKinetixDirectionProvider.
Usage#
A consuming app needs both dir on <html> and the provider around its
tree:
import { KinetixDirectionProvider } from "@kinetixui/ui";
<html dir={dir}>
<body>
<KinetixDirectionProvider dir={dir}>{children}</KinetixDirectionProvider>
</body>
</html>dir is whatever your app derives it from (a locale, a user setting) —
KinetixUI doesn't ship locale detection or persistence; it just mirrors
correctly once told which direction to render.
Overlays and placement#
Popups are where direction most often breaks, because their content is portaled out of the element that set
dir. On React the direction provider above is what carries it into the portal: menus, selects and popovers
read the provider, not the page. One deliberate exception uses a physical side: a Sheet's
side="left" stays on the left in a right-to-left layout, because the caller chose a screen edge. The Angular
library takes the other route to the same outcome: its overlays use the browser's top layer rather than a portal,
so a surface stays inside the subtree that set its direction, and floating surfaces take a logical side (start,
end). See Angular.
What is checked#
- Source.
pnpm check:rtlfails CI when a converted React file gains a physical-direction class, and lists the files not converted yet (RTL.mdhas the current count). - Keyboard. Keyboard tests assert that arrow keys mirror under
dir="rtl"for Tabs and Data Grid, among others; a submenu's placement under RTL has its own test. - Native platforms. Each platform's RTL tests are counted per component on Supported platforms. A component without one is not audited, which is not the same as broken.
None of this is a visual-regression check of every component in right-to-left, which does not exist yet.
Native platforms#
Each native port has its own, separate direction mechanism, independent
of this conversion: Jetpack Compose's LocalLayoutDirection, SwiftUI's
layoutDirection environment value, and Flutter's Directionality. Wire
each through your app the way you would any other platform-native RTL
setting.
Directional icons (back, previous and next, breadcrumb separators) turn around with the direction on every platform; close marks, checks and media controls do not. Icons lists which is which, and what to do for icons you pass in yourself.
Related guides#
- Accessibility: keyboard, focus and contrast evidence for the React library.
- Platform coverage: RTL test evidence counted per platform.
- Direction Provider: the component that sets direction for a subtree.
- Design tokens: the spacing scale the logical properties above are built on.