Skip to main content

DirectionProvider

Enables RTL (right-to-left) behavior for Base UI components.

Import

Component Signature

Props

React.ReactNode
The content to be wrapped by the direction provider.
TextDirection | undefined
default:"'ltr'"
The reading direction of the text. Can be 'ltr' (left-to-right) or 'rtl' (right-to-left).

Type Definitions

DirectionProvider.Props

TextDirection

useDirection Hook

A hook to access the current text direction from context.

Signature

Return Value

Returns the current text direction ('ltr' or 'rtl'). Defaults to 'ltr' if used outside a DirectionProvider.

Usage Example