Skip to contents

Direction Provider

Enables RTL behavior for Base UI components.

View as Markdown

Anatomy

Import the component and wrap it around your app:

Anatomy

<DirectionProvider> enables child Base UI components to adjust behavior based on RTL text direction, but does not affect HTML and CSS. The dir="rtl" HTML attribute or direction: rtl CSS style must be set additionally by your own application code.

API reference

DirectionProvider

Enables RTL behavior for Base UI components.

direction
TextDirection
'ltr'
Description

The reading direction of the text

Type
TextDirection | undefined
Default
'ltr'
children
React.ReactNode
Type
React.ReactNode | undefined

Additional Types

DirectionProvider.Props

Re-Export of DirectionProvider props as DirectionProviderProps

useDirection

Use this hook to read the current text direction. This is useful for wrapping portaled components that may be rendered outside your application root and are unaffected by the dir attribute set within.

Return value

TextDirection

Additional Types

Additional Types

TextDirection