# Torso

A pelvis, a column of equal vertebrae, and a cage of rib hoops. Leaning and twisting move the shoulders without stretching the back, and breathing opens the cage along the machine's depth.

> 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/robot-torso.json
```

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

## Notes

- Every vertebra is the same distance from the one below it in every pose, because the column is built as a chain of unit directions rather than as points that are bent afterwards.
- The ribs are open arcs leaving their own vertebra and descending as they come forward, drawn in the transverse plane — so they foreshorten into the ellipses a real cage makes from a raised camera. The lowest hoops float: they fall away further and stop short of the midline.
- No balance and no mass. Lean is a number someone typed, and nothing here would fall over.

## Usage

```tsx
import { RobotTorso } from "@/components/ui/robot-torso"

<RobotTorso behavior="breathe" ribs={7} />

// Controlled, or a column you can bend by hand.
<RobotTorso lean={18} twist={-24} breath={0.8} view="iso" />
<RobotTorso interactive onLeanChange={setLean} onTwistChange={setTwist} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One torso, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `lean` | `number` | — | Controlled pitch in degrees, positive toward the nose, clamped to -35..45. Supplying any pose prop stops the loop. |
| `twist` | `number` | — | Controlled shoulder counter-rotation against the pelvis, in degrees, clamped to ±40. |
| `sway` | `number` | `0` | Lateral roll of the whole column about the sacrum, in degrees, clamped to ±25. |
| `breath` | `number` | — | Controlled cage expansion, 0 empty to 1 full. |
| `behavior` | `"breathe" | "twist" | "static"` | `"breathe"` | Work the cage, or wind the shoulders against the hips. |
| `ribs` | `number` | `7` | How many rib hoops the cage is built from, 3 to 10. The vertebra count follows it. |
| `speed` | `number` | `0.35` | Breaths, or twists, 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 across to twist and up and down to lean. |
| `onLeanChange` | `(lean: number) => void` | — | Pitch in degrees throughout a drag or a key press. |
| `onTwistChange` | `(twist: number) => void` | — | Shoulder rotation in degrees throughout a drag or a key press. |
| `showHips` | `boolean` | `true` | Draw the pelvis casting and its hip sockets. |
| `label` | `string` | — | Caption below the pose 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/robot-torso.tsx`
