# General Translation React SDKs (gt-react, gt-next): useLocaleDirection URL: https://generaltranslation.com/en-US/docs/react/reference/hooks/use-locale-direction.mdx --- title: useLocaleDirection description: Read the text direction for a locale with General Translation gt-react. API reference for useLocaleDirection. --- The `useLocaleDirection` hook returns the text direction — `'ltr'` or `'rtl'` — for the current locale, or for a locale you specify. *Available in `gt-react`, `gt-next`, and `gt-react-native`. Examples import from `gt-react`; import from your framework's package instead.* *Note: not exported by `gt-tanstack-start`.* ## Overview [#overview] Call `useLocaleDirection` to get the direction, and apply it with the `dir` attribute. ```tsx import { useLocaleDirection } from 'gt-react'; export default function DirectionWrapper({ children }) { const dir = useLocaleDirection(); // [!code highlight] return
{children}
; } ``` *Note: In `gt-react`, call `useLocaleDirection` under a [``](/docs/react/reference/components/gt-provider). In `gt-next`, it also works in synchronous server components.* ## How it works [#how-it-works] When called with no argument, the hook returns the direction of the active locale. Pass a locale code to get the direction of a specific locale. It is useful for setting the `dir` attribute to support right-to-left languages. ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | --- | --- | --- | --- | --- | | [`locale`](#locale) | The locale to check. | `string` | Yes | Active locale | ### `locale` [#locale] **Type** `string` · **Optional** · **Default** Active locale A BCP 47 locale code, such as `ar` or `en-US`. When omitted, the active locale from context is used. ## Returns [#returns] **Type** `'ltr' | 'rtl'` The text direction for the locale. ## Examples [#examples] ```tsx title="SpecificDirection.tsx" import { useLocaleDirection } from 'gt-react'; export default function SpecificDirection() { const dir = useLocaleDirection('ar'); // 'rtl' [!code highlight] return

Arabic text direction: {dir}

; } ``` ## Notes [#notes] - In an async App Router component, use [`getLocaleDirection`](/docs/react/nextjs/reference/functions/get-locale-direction) instead. - Useful for setting the `dir` attribute on elements for RTL support.