# Cable carrier

The energy chain that feeds a moving axis. The chain cannot change length, so its fold travels at exactly half the carriage — which is the whole mechanism.

> 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/cable-carrier.json
```

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

## Notes

- Links are placed by arc length along the solved path, not drawn in three poses and interpolated, so the pitch between neighbours is the same on both runs and right round the bend at every travel.
- The fold moves at half the carriage rate because the chain length is fixed — solve (bend − anchor) + πr + (bend − carriage) = length and that is what falls out. The readout prints the length so you can watch it not change.
- The chain plates are drawn in their own plane and have no modelled thickness; the trough, the rail and the carriage do.

## Usage

```tsx
import { CableCarrier } from "@/components/ui/cable-carrier"

<CableCarrier links={26} cables={3} />

// Controlled, or a carriage you can drag.
<CableCarrier travel={0.65} />
<CableCarrier interactive onTravelChange={setTravel} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One carrier, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `travel` | `number` | — | Controlled carriage position, 0–1 along the run. Omit it and the carriage runs behavior. |
| `behavior` | `"cycle" | "creep" | "static"` | `"cycle"` | Run the full stroke with a dwell at each end, or creep back and forth about the middle. |
| `speed` | `number` | `0.25` | Full strokes per second, or creep cycles per second. |
| `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 carriage along its rail, or arrow-key it five percent at a time. |
| `onTravelChange` | `(travel: number) => void` | — | Carriage travel, 0–1, throughout a drag or a key press. |
| `links` | `number` | `26` | Links in the chain, rounded and clamped to 8–40. The pitch is whatever the fixed length divides into. |
| `cables` | `number` | `3` | Strands threaded through the chain, rounded and clamped to 0–4. |
| `showRail` | `boolean` | `true` | Draw the rail the carriage runs on above the chain. |
| `label` | `string` | — | Caption below the travel 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/cable-carrier.tsx`
