# Cyber trooper

A converted armoured humanoid with a blank slab head, optional side handles, three chest units, a bounded power meter, and four controlled poses.

> 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/cyber-trooper.json
```

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

## Notes

- Front elevation is the drawing it always had. A humanoid drawn from the front says nothing about its own depth: off that axis the torso, pelvis and head are boxes and the limbs are tubes set through the body, at the same joint angles the pose already solved.
- Supply a value and it renders exactly as given; leave it out and the behaviour runs it.
- The power meter is display state, not a battery model — the parent decides what a reserve means.

## Usage

```tsx
import { CyberTrooper } from "@/components/ui/cyber-trooper"

<CyberTrooper pose="march" chestUnit="core" power={0.45} handles headAngle={-14} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One trooper, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `pose` | `"stand" | "march" | "reach" | "powerdown"` | — | Whole-body posture; powerdown slumps the frame and dims the optics. Omit and the behaviour drives it. |
| `headAngle` | `number` | — | Head rotation in degrees, clamped to −40..40. Omit and it turns to whoever it is facing. |
| `chestUnit` | `"bar" | "vent" | "core"` | `"bar"` | Chest module face; core also scales with the power reserve. |
| `helmet` | `"slab" | "domed" | "crested"` | `"slab"` | Head shell silhouette, drawn into the same envelope. |
| `build` | `"standard" | "heavy"` | `"standard"` | Frame width. Scales limbs and torso across only — every joint keeps its height, so poses are unchanged. |
| `visor` | `"lamps" | "slit" | "bar"` | `"lamps"` | Optic treatment on the faceplate; all three dim under powerdown. |
| `shoulders` | `"pauldron" | "flush"` | `"pauldron"` | Capped pauldrons, or arms running flush to the torso. |
| `jaw` | `boolean` | `true` | Draw the hinged jaw plate. |
| `power` | `number` | — | Power reserve 0–1 shown in a fixed meter track. Omit and marching draws it down and standing puts it back. |
| `handles` | `boolean` | `true` | Draw the two side handles on the head shell. |
| `behavior` | `"march" | "advance" | "idle" | "static"` | `"march"` | March steps and spends the reserve, then halts to recharge; advance marches and reaches; idle stands by on a trickle charge. |
| `speed` | `number` | `0.4` | Steps 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` | `true` | The head turns to the pointer, and a click cuts its power — click again to bring it back. `onPowerChange` reports both. |
| `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. |
| `showGround` | `boolean` | `true` | Draw the contact line or shadow beneath the droid. |
| `signal` | `"idle" | "ready" | "warning"` | — | Status-lamp state using neutral, accent, or shell colour; each component documents its visual default in the demo. |
| `label` | `string` | — | Optional technical caption under the drawing. |
| `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/cyber-trooper.tsx`
