---
title: "Direction"
description: "Sets the writing direction for a subtree and exposes it to the components that need to know which way is forward."
---

Sets the writing direction for a subtree and exposes it to the components that need to know which way is forward. Compose it from the exported registry parts so local content and behaviour stay in the application while the visual contract stays token-driven.

_Live example of Direction — see the page for the rendered demo._

## Installation

```bash
npx newtui@latest add direction
```

Files written — React: components/ui/direction.tsx. Vue: components/ui/direction/DirectionProvider.vue, components/ui/direction/useDirection.ts, components/ui/direction/index.ts.

## Usage

React:

```tsx
import { Direction } from "@/components/ui/direction"
```

Vue:

```ts
import { DirectionProvider } from "@/components/ui/direction"
```

## API reference

**`DirectionProvider`**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `dir` | `Direction` | — | Required dir value. |

The registry exports `Direction`, `DirectionProvider`. Parts without a table accept the native attributes for the element they render; React uses `className`, while Vue uses `class` and fallthrough attributes.

## Accessibility

Preserve the native semantics of the rendered elements and pass through ARIA attributes when the surrounding context needs a label or description. Any interactive child needs a visible focus indicator, and meaning must not rely on colour alone.

## Tokens

Direction reads its colours, radii and motion from the `--newt-*` tokens. Override a token rather than editing the component.
