# DirectionProvider

Sets the reading direction that arrow-key navigation follows below it. `useDirection` reads it, falling back to `ltr` with no provider, and `readingDirectionKeys` maps it to the previous and next arrow keys.

## Use for

- right-to-left arrow-key navigation
- reading the text direction in a primitive that handles arrow keys

## Practices

- Do: Set `MosaicProvider`'s `direction` to match the page's `dir`. It renders this provider.
- Do: In a primitive, get the arrow keys from `readingDirectionKeys(useDirection())` instead of hard-coding `ArrowLeft` and `ArrowRight`.
- Don't: Expect it to set `dir` on the DOM. It only steers keyboard navigation.

## API reference

### DirectionProvider

Provides the direction to its children. Renders no element.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `direction` | `TextDirection` | `'ltr'` | `ltr` or `rtl`. |

## Related

- `MosaicProvider`
