# Linear actuator

A linear cylinder with a moving piston and rod. Reveal its internals in cutaway view, or use the complete housing in a production-cell illustration.

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

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

## Notes

- Side elevation is the drawing it always had. A cylinder is round in section, which only reads off that axis: the barrel, the rod and the end flanges are tubes down the machine’s axis.
- A supplied extension always wins and stops the loop. Uncontrolled the cylinder runs its own cycle; grabbing it pins the stroke to the pointer, and releasing eases it back in at the cylinder's own rate.
- The piston and rod move together through a fixed illustrative stroke; the component does not simulate fluid pressure or force.
- The scale is a percentage of the drawing's stroke, not a measurement in physical units.

## Usage

```tsx
import { LinearActuator } from "@/components/ui/linear-actuator"

<LinearActuator cutaway size="lg" />

// Controlled, or a control:
<LinearActuator extension={0.75} />
<LinearActuator interactive onExtensionChange={setTravel} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One cylinder, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `extension` | `number` | — | Controlled stroke, clamped to 0–1. Zero retracts and one fully extends. Omit it and the cylinder runs behavior. |
| `behavior` | `"cycle" | "breathe" | "static"` | `"cycle"` | The duty cycle — stroke out, dwell, stroke back, dwell — or a continuous sine. |
| `speed` | `number` | `0.32` | Duty 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 rod along its stroke or arrow-key it; the cylinder becomes a slider and eases back into its cycle on release. |
| `onExtensionChange` | `(extension: number) => void` | — | Fired throughout a drag or a key press, in controlled mode too. |
| `cutaway` | `boolean` | `false` | Make the cylinder wall translucent and reveal the piston. |
| `showRuler` | `boolean` | `true` | Stroke scale and percentage under the rod. |
| `label` | `string` | — | Caption under the assembly. |
| `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/linear-actuator.tsx`
