Direction Provider
Overview
DirectionProvider manages the dir HTML attribute which controls CSS logical properties and layout direction. All Paramanu CSS uses logical properties so components automatically adapt to the configured direction.
Usage
import { setDirection, getDirection } from "@paramanu/utilities-js"
setDirection("rtl")console.log(getDirection()) // "rtl"import { DirectionProvider, useDirection } from "@paramanu/utilities-react"
<DirectionProvider defaultDir="ltr"> <App /></DirectionProvider>
// Inside a component:const { dir, setDir } = useDirection()Guidelines
- Use for applications that support Arabic, Hebrew, or other RTL languages
- All Paramanu components use CSS logical properties for automatic adaptation
- The
useDirectionhook provides read/write access to the current direction - Sets the
dirattribute ondocument.documentElementby default
API
| Prop | Type | Default | Description |
|---|---|---|---|
defaultDir | "ltr" | "rtl" | "ltr" | Initial text direction |