# Direction Set the reading and inline layout direction for a whole interface or a named region. [Interactive guide](/docs/components/direction) · Forge 3.2.0 Use the API for your installed version. Run `npx --no-install wss3-forge api --json` inside the project. ## Implementation guidance ### When to use it Use Direction when the application or a named region reads right to left. ### How to compose it Set direction at the closest shared scope. Prefer start and end values and logical inline spacing for rows and overlays. ### What to verify Verify keyboard navigation, popup placement and input alignment in both directions. ## Usage ```tsx import { Direction, DirectionProvider, useDirection } from 'wss3-forge' ``` - Set dir for a region that shares a reading direction. Set lang separately for pronunciation and localization. - Use DirectionProvider for context without a wrapper element. For a whole page, set dir and lang on html and pass the same direction to DirectionProvider. - Read the nearest Forge Direction value with useDirection when a child needs direction-dependent logic. - Use logical layout properties for custom positioning. Test the direction of arrow navigation and floating content as well as text order. ```tsx

مرحبا

``` ## Runnable examples ### Localized sign-in form ```tsx import { useState } from 'react' import { Button, Card, DirectionProvider, HStack, Input, Select, PasswordInput, Text, VStack, useDirection } from 'wss3-forge' const languages = { ar: { name: 'العربية', title: 'الدخول إلى الاستوديو', intro: 'استخدم بيانات تجريبية لاستكشاف النموذج.', email: 'البريد الإلكتروني', password: 'كلمة المرور', show: 'إظهار كلمة المرور', hide: 'إخفاء كلمة المرور', submit: 'تسجيل الدخول', demo: 'استخدام بيانات تجريبية', done: 'تم التحقق من النموذج.' }, he: { name: 'עברית', title: 'כניסה לסטודיו', intro: 'אפשר לנסות את הטופס עם פרטי הדוגמה.', email: 'דוא״ל', password: 'סיסמה', show: 'הצגת הסיסמה', hide: 'הסתרת הסיסמה', submit: 'כניסה', demo: 'שימוש בפרטי הדוגמה', done: 'הטופס אומת.' }, fa: { name: 'فارسی', title: 'ورود به استودیو', intro: 'فرم را با اطلاعات نمونه امتحان کنید.', email: 'ایمیل', password: 'گذرواژه', show: 'نمایش گذرواژه', hide: 'پنهان کردن گذرواژه', submit: 'ورود', demo: 'استفاده از اطلاعات نمونه', done: 'فرم بررسی شد.' }, en: { name: 'English', title: 'Studio sign-in', intro: 'Try the form with the demo details.', email: 'Email', password: 'Password', show: 'Show password', hide: 'Hide password', submit: 'Sign in', demo: 'Use demo details', done: 'Form validated.' }, } as const type Language = keyof typeof languages function StudioForm({ language }: { language: Language }) { const words = languages[language] const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [submitted, setSubmitted] = useState(false) const dir = useDirection() return
{ event.preventDefault(); setSubmitted(true) }} onChange={() => setSubmitted(false)}> {submitted && {words.done}}
} export function LocalizedSignIn() { const [language, setLanguage] = useState('ar') return {submitted && {words.done}} } export default function LocalizedSignIn() { const [language, setLanguage] = useState('ar') return {submitted && {words.done}} } export default function LocalizedSignIn() { const [language, setLanguage] = useState('ar') return {submitted && {words.done}} } export default function LocalizedSignIn() { const [language, setLanguage] = useState('ar') return