# Rotary table

A rotary indexing table in plan view. Fixtures and workpieces rotate with the platter while the base, motor, and index pointer stay fixed.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/rotary-table.json
```

Registry item: `rotary-table` · [`https://robocn.dev/r/rotary-table.json`](https://robocn.dev/r/rotary-table.json)

## Notes

- Plan view is the identity projection, and the platter’s own rotation composes onto the camera, so a tipped table still indexes truthfully. The base, the platter’s thickness and the fixtures are solids that only read off the vertical.
- A supplied angle always wins and stops the loop; index it yourself by setting angle to stationIndex * 360 / stations. Uncontrolled, indexing is a staircase goal plus a 150°/s slew — the dwell is what is left between steps.
- Zero degrees aligns the first fixture to the fixed pointer at the top. The remaining fixtures are equally spaced clockwise.

## Usage

```tsx
import { RotaryTable } from "@/components/ui/rotary-table"

<RotaryTable stations={6} loaded variant="blueprint" />

// Controlled, or a dial: drag to spin, click a fixture to index it up.
<RotaryTable angle={60} />
<RotaryTable interactive onStationChange={setStation} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One table, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `angle` | `number` | — | Controlled clockwise platter angle in degrees. Wraps after each turn. Omit it and the platter runs behavior. |
| `behavior` | `"index" | "spin" | "static"` | `"index"` | Step station to station with a dwell between, or turn continuously. |
| `speed` | `number` | `0.5` | Index steps per second, or turns per second while spinning. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `interactive` | `boolean` | `false` | Drag the platter to spin it, click a fixture to bring it round to the pointer, or arrow-key one station at a time. |
| `onAngleChange` | `(angle: number) => void` | — | The platter angle, wrapped to 0–360, whenever a person moves it. |
| `onStationChange` | `(station: number) => void` | — | Which station has been indexed to the pointer. |
| `stations` | `number` | `6` | Equally spaced fixtures, rounded and clamped to 0–12. Non-finite values use six; zero gives a bare platter. |
| `loaded` | `boolean` | `true` | Show a workpiece in every fixture. |
| `showTicks` | `boolean` | `true` | Draw the graduated angle marks on the rotating platter. |
| `label` | `string` | — | Caption below the stationary angle readout. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/rotary-table.tsx`
