# Direction (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-direction` · version 1.0.0 · component · free
- category: Layout
- build: Base UI (this item also ships a Radix build)
- install (this build): `npx shadcn@latest add https://beautiful-ui.dev/r/lumen-direction.json`
- npm dependencies: @base-ui/react@^1
- registry dependencies: utils
- docs: https://beautiful-ui.dev/components/lumen-direction
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

Set right-to-left once, and every Lumen part follows: tabs, thumbs, lenses, menus and charts. shadcn's Direction, for Lumen Halo.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: `@base-ui/react@^1` (Base UI build); `radix-ui@^1` (Radix build).
- Files: `components/ui/lumen/direction.tsx`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn).
- Builds: separate Base UI and Radix files. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `DirectionProvider`, `useDirection`, and every exported type.
- CSS: the install adds the lumen foundation (tokens, keyframes, motion levels) to your global stylesheet once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`). Never add Tailwind colour classes inside the component.

```tsx
import { DirectionProvider } from "@/components/ui/lumen/direction";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `DirectionProvider` | — | Provides the direction. |
| `useDirection` | — | Reads it. |

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/direction.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- direction, rtl, right to left, arabic, hebrew, shadcn direction, Lumen
- Apps in right-to-left languages

### Not when
- Left-to-right only apps: you don't need it

## Mistakes
- Set it once, near the root

## Usage

```tsx
import { DirectionProvider } from "@/components/ui/lumen/direction";

<DirectionProvider direction="rtl">…</DirectionProvider>
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `DirectionProvider direction / dir` | `"ltr" \| "rtl"` |  | The reading direction. |

Full docs: https://beautiful-ui.dev/components/lumen-direction

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| — | Arrow keys flip with the direction |

## Motion inventory

| Interaction | What moves |
|---|---|
| None | Indicators re-measure on a direction change |

## Accessibility contract (preserve when editing)
- Set dir on <html> too, so the browser lays text out right

## Install

Base UI project (a base-* style in components.json):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/lumen-direction.json
```

Radix project (a radix-*, new-york or default style):

```bash
npx shadcn@latest add https://beautiful-ui.dev/r/radix-nova/lumen-direction.json
```

Or add the `@beautiful-ui` registry to components.json and run `npx shadcn@latest add @beautiful-ui/lumen-direction`: the CLI picks the build from your style.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

## Source (Base UI build)

### components/ui/lumen/direction.tsx

```tsx
"use client";

/**
 * Direction (Lumen Halo) v1.0.0 · Beautiful UI
 * Docs: https://beautiful-ui.dev/components/lumen-direction · Agent prompt: https://beautiful-ui.dev/md/lumen-direction.md
 * Licensed to the purchaser under the Beautiful UI license: https://beautiful-ui.dev/license
 */

/* Lumen Direction (Base UI build). shadcn's Direction: set right-to-left once, and every Lumen part (tabs, thumbs, lenses, menus, charts) follows it. */

export { DirectionProvider, useDirection } from "@base-ui/react/direction-provider";
```
