# Voice-coil actuator

A moving coil and carriage travel in both directions through a fixed annular magnetic gap. Unlike the generic linear cylinder, its electromagnetic working parts remain exposed.

> 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/voice-coil-actuator.json
```

Registry item: `voice-coil-actuator` · [`https://robocn.dev/r/voice-coil-actuator.json`](https://robocn.dev/r/voice-coil-actuator.json)

## Notes

- The coil travel and gap are geometric. Field marks do not report force, flux density, current, frequency or heating.

## Usage

```tsx
import { VoiceCoilActuator } from "@/components/ui/voice-coil-actuator"

<VoiceCoilActuator behavior="oscillate" view="iso" />
<VoiceCoilActuator position={-0.4} interactive onPositionChange={setPosition} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `position` | `number` | — | Controlled bipolar carriage position from −1 to 1. |
| `behavior` | `"oscillate" | "pulse" | "static"` | `"oscillate"` | Automatic bidirectional motion. |
| `travel` | `number` | `42` | Visible stroke, clamped to 20–60 world units. |
| `interactive / onPositionChange` | `boolean / (position: number) => void` | — | Drag or arrow-key the carriage. |
| `showField` | `boolean` | `true` | Show qualitative loops through the magnet gap. |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One voice-coil actuator, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `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. |
| `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/voice-coil-actuator.tsx`
