Direction
This repo is RTL-first by default, but DirectionProvider is useful when you need to force a specific direction on a subtree regardless of the page's own dir — for example, an embedded LTR code block inside an otherwise RTL page.
Last updated January 1, 1980
CreditsUnchangedPublished
Copied from shadcn/ui.
Overview
Installation
Usage
import { DirectionProvider } from "@/components/ui/direction"
export function Example() {
return (
<DirectionProvider direction="rtl">
{/* Base UI components inside here read RTL */}
</DirectionProvider>
)
}Examples
useDirection
Read the direction set by the nearest DirectionProvider with the useDirection hook.