# Orbit (Lumen Halo): prompt.md (v2.0.0)

- id: `lumen-orbit` · version 2.0.0 · component · pro (in Lumen Story Charts, $39, or All-Access)
- category: Charts
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add @beautiful-ui-pro/lumen-orbit`
- npm dependencies: none
- registry dependencies: utils, @beautiful-ui/lumen-chart, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-orbit
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

A whole split into parts, drawn as lit dots on rings: 100 by default, one per percent, each part a sector. Dots are shared out exactly (they always add up), a period switch recolours them in a sweep, and pointing at a part lifts its dots while the centre reads its value. The headline names the largest part and who grew most. In parts.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: none beyond React.
- Files: `components/ui/lumen/orbit.tsx`; shared code: `lib/beautiful-ui/lumen/orbit-model.ts`, `lib/beautiful-ui/lumen/orbit-sample.ts`, `lib/beautiful-ui/lumen/sound.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-chart`, `lumen-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. 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: `Orbit`, `OrbitRing`, `OrbitHeadline`, `OrbitNote`, `OrbitTable`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) 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`); this item's CSS also reads `--lumen-font-mono`, `--lumen-font-sans`, `--lumen-radius-k`. Never add Tailwind colour classes inside the component.

```tsx
import { Orbit, OrbitHeadline, OrbitLegend, OrbitRing, OrbitTable } from "@/components/ui/lumen/orbit";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `Orbit` | — | Data, period and the highlighted part. |
| `OrbitRing` | `orbit-ring` | The dots and the centre readout. |
| `OrbitHeadline` | — | The largest part and who grew most. |
| `OrbitNote` | `orbit-note` | The dot key and missing parts. |
| `OrbitTable` | — | Every value for screen readers. |

Style a part with `[data-slot="<slot>"]` selectors or its `className`; keep the attributes when editing.

## 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/orbit.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
- usage mix, share of total, traffic by product, spend by team, part to whole over periods, dot ring chart, Lumen
- How a whole splits into up to about six parts, over a few periods
- Which part grew its share, at a glance

### Not when
- Values that don't add up to a whole (or can be negative): use Bar
- Close values that need exact comparison: the ring reads at one dot's resolution; the legend has the numbers
- Long time series: use Line or Area

## Mistakes
- Values must be parts of one whole: negative values are refused in words
- Keep to about six parts; fold the rest into Other

## Usage

```tsx
import { Orbit, OrbitHeadline, OrbitLegend, OrbitRing, OrbitTable } from "@/components/ui/lumen/orbit";

<Orbit
  categories={[{ id: "web", label: "Web" }, { id: "ios", label: "iOS" }, { id: "android", label: "Android" }]}
  periods={[{ id: "sep", label: "September", values: [5200, 3100, 1900] }]}
  metric="Sessions"
>
  <OrbitHeadline />
  <OrbitRing size={280} />
  <OrbitLegend />
  <OrbitTable />
</Orbit>
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `categories` | `{ id, label }[]` | `the sample parts` | The parts, clockwise from 12 o'clock. Put "Other" last. |
| `periods` | `{ id, label, values, prev?, delta? }[]` | `7D, 30D, 90D, 12M` | values per category are absolute (shares are worked out); null is missing and named. prev gives the change in share; delta is the total's change as a ratio. |
| `period / defaultPeriod / onPeriodChange` | `string` |  | The shown period's id (default: the second one). |
| `activeCategory / defaultActiveCategory / onActiveCategoryChange` | `string \| null` |  | The highlighted part's id: link it to other charts. |
| `config` | `ChartConfig` |  | Colours by category id (shadcn's shape). Unlisted ids take the series colours in order (Lumen's, or your --chart-N under lumen-inherit). |
| `title / eyebrow / metric` | `string` | `"Orbit" / — / "Requests"` | The accessible name and table caption, the label above the headline, and what the total counts (centre and dot key). |
| `dots` | `number` | `100` | How many dots make the whole (100: one per percent). |
| `labels` | `Partial<OrbitLabels>` |  | Every sentence and word, for i18n. |
| `formatValue / formatShare / locale` | `(v) => string / (ratio) => string / string` |  | Values (compact by default) and shares (whole percents). |
| `motion` | `"full" \| "subtle" \| "off"` | `"full"` | full: dots arrive and recolour in a sweep; off (and reduced motion): instant. |
| `Parts` | `OrbitRing · Legend · Periods · Headline · Note · Table · Card` |  | Arrange them inside <Orbit>, or use OrbitCard; useOrbit() reads the state. |

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

## Customising
- Motion: `motion="full"` (default) | `"subtle"` | `"off"`. prefers-reduced-motion is always respected.
- 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 |
|---|---|
| ← / → | Move between parts |
| Escape | Clear the highlight |
| ← / → on the periods | Switch period |

## Motion inventory

| Interaction | What moves |
|---|---|
| Enter | Dots arrive clockwise from 12 o'clock |
| Period | Dots recolour in a clockwise sweep; the legend bars ease |
| Point | The part's dots lift and glow; the rest dim |

## Accessibility contract (preserve when editing)
- The ring is one tab stop: arrows walk the parts and each is announced with its share, value and change
- Legend rows are buttons named in full; focusing one highlights its dots
- The headline is computed and stays true for ties, one part, missing and negative values
- Every value, share and change is in the data table

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/lumen-orbit
```

Pro item: needs the `@beautiful-ui-pro` registry in `components.json` and `BEAUTIFUL_UI_TOKEN` in `.env.local` (https://beautiful-ui.dev/account). Setup: https://beautiful-ui.dev/docs/pro. Your components.json `style` picks the build: radix-*, new-york and default get Radix, base-* gets Base UI.

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

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
