# Tool changer

The coupler between a wrist and whatever it is holding, and the only machine in the set that comes apart. One axis seats the halves and then drives the lock.

> 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/tool-changer.json
```

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

## Notes

- One axis, two stages the drawing keeps separate: below 0.6 the halves are closing the gap and the lock cannot move; above it they are seated and the piston drives the balls out. The accessible label names which of parked, seated and locked it is in.
- Nothing is drawn locked. The balls are wherever the piston has pushed them, which is why the lock reads as a mechanism rather than as a state colour.
- No collision, no keying, no air or signal couplings — the pneumatic and electrical passes a real changer carries are not modelled.

## Usage

```tsx
import { ToolChanger } from "@/components/ui/tool-changer"

<ToolChanger tool="spindle" balls={6} />

// Controlled, or a half you can lift into place.
<ToolChanger engagement={1} />
<ToolChanger interactive onEngagementChange={setEngagement} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One coupler, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `engagement` | `number` | — | Controlled engagement, 0 parked to 1 locked. Omit it and the coupler runs behavior. |
| `behavior` | `"dock" | "latch" | "static"` | `"dock"` | Run a whole tool change, or work the lock with the halves left seated. |
| `speed` | `number` | `0.3` | Dock cycles per second, or latch 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 tool half up to the coupler, or arrow-key it five percent at a time. |
| `onEngagementChange` | `(engagement: number) => void` | — | Engagement, 0–1, throughout a drag or a key press. |
| `tool` | `"gripper" | "spindle" | "vacuum" | "none"` | `"gripper"` | What is hanging off the tool half. |
| `balls` | `number` | `6` | Lock balls round the spigot, rounded and clamped to 3–8. |
| `showDock` | `boolean` | `true` | Draw the stand the tool half is parked in. |
| `label` | `string` | — | Caption below the state 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/tool-changer.tsx`
