Capítulo 49 de 51
Tells Base UI components (arrow-key navigation direction, positioning logic) that the app is RTL — it does not touch actual HTML/CSS direction, which the app must still set itself via dir="rtl"/direction: rtl.
<DirectionProvider direction="rtl"> wraps the app or a subtree — no other parts.dir="rtl" on the relevant DOM ancestor and any RTL-aware CSS.useDirection hook: reads the current direction — specifically useful for content portaled outside the app root (which wouldn't otherwise inherit an ancestor's dir attribute) so it can apply RTL-aware styling itself.'ltr' if no provider is present.| Export | Notable props / return |
|---|---|
DirectionProvider | direction: 'ltr' | 'rtl' (default 'ltr') |
useDirection() | returns 'ltr' | 'rtl' |
DirectionProvider with your own dir="rtl" on the actual DOM root — the provider alone changes no visuals.useDirection() inside any custom component rendered into a portal (e.g. a custom popup content component) that needs to know the ambient direction, since it won't inherit dir through the portal boundary automatically.