# Direction

> Switches a subtree between left-to-right and right-to-left flow.

Layout direction helper. RTL reverses visual horizontal flow while preserving logical/focus order. Text bidi is not changed.

- Category: [Window & layout](https://tarve.dev/docs.md#layout)
- Import: `import { Direction } from "@tarve/core";`
- Props type: `DirectionProps`
- Source: [packages/core/src/form-controls.ts:495](https://github.com/omarcosr/tarve/blob/main/packages/core/src/form-controls.ts#L495)

## Usage

```tsx title="Direction.tsx"
import { Badge, Column, Direction, Text, theme } from "@tarve/core";

<Column gap={12}>
  <Direction dir="ltr" gap={8}>
    <Badge>1</Badge>
    <Badge variant="secondary">2</Badge>
    <Badge variant="outline">3</Badge>
    <Text color={theme.colors.mutedForeground}>dir="ltr"</Text>
  </Direction>
  <Direction dir="rtl" gap={8}>
    <Badge>1</Badge>
    <Badge variant="secondary">2</Badge>
    <Badge variant="outline">3</Badge>
    <Text color={theme.colors.mutedForeground}>dir="rtl"</Text>
  </Direction>
</Column>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `dir` | `"ltr" \| "rtl"` | `"ltr"` |  |
| `gap` | `number` | `0` |  |
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

Previous: [AspectRatio](https://tarve.dev/docs/components/AspectRatio.md) · Next: [Separator](https://tarve.dev/docs/components/Separator.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/Direction · Index for agents: https://tarve.dev/llms.txt
