# Skeleton

The whole biped, walking: legs solved to a rolling foot, an equal-segment spine under a rib cage, arms counter-swinging, and hands on the same solver the standalone hand ships on.

> 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-skeleton.json
```

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

## Notes

- This is a skeleton, not shadcn's skeleton loading placeholder. It installs to @ui/robot-skeleton.tsx and collides with nothing, but the two names mean different things in one project.
- The stride is worked in the body frame: the pelvis stays at x = 0 and the feet travel under it, which is why a walk cycle and a treadmill are the same drawing. A stride the leg could not reach is capped rather than left to the solver to clamp.
- The hands are solveHand at a fifth scale, so the machine's grip is the same mechanism robot-hand ships on its own.
- No balance, no centre of mass, no ground reaction, no dynamics. The hip height is a number someone typed. The readout says grounded or flight because the duty factor says so, not because anything is being simulated.

## Usage

```tsx
import { RobotSkeleton } from "@/components/ui/robot-skeleton"

<RobotSkeleton behavior="walk" view="profile" />

// Controlled, or a gait you can scrub by hand.
<RobotSkeleton gait="run" phase={0.44} stride={1} lift={1} />
<RobotSkeleton interactive onPhaseChange={setPhase} grasp="power" grip={1} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One machine, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the loop. Wraps in both directions. |
| `gait` | `"stand" | "walk" | "run" | "march"` | — | Footfall pattern. Omit and behavior picks one. Run is a walk with a duty factor under a half, which is what puts both feet in the air. |
| `behavior` | `"walk" | "run" | "march" | "idle" | "static"` | `"walk"` | What it does when phase is not supplied. Idle stands and rocks a degree or two. |
| `stance` | `number` | `1` | Hip height, 0 crouched to 1 standing tall. |
| `stride` | `number` | `0.7` | Stride length, 0 to 1, capped at what the leg can actually reach. |
| `lift` | `number` | `0.6` | Foot clearance through the swing, 0 to 1. |
| `lean` | `number` | — | Whole-column pitch in degrees. Omit and the gait picks one. |
| `twist` | `number` | `0` | Extra shoulder rotation against the pelvis, on top of the gait's own. |
| `gazePitch` | `number` | `0` | Head pitch in degrees, clamped to ±35. |
| `gazeYaw` | `number` | `0` | Head yaw in degrees, clamped to ±60. |
| `grasp` | `"open" | "pinch" | "tripod" | "power" | "hook" | "point" | "lateral"` | `"open"` | What the hands are doing. The same grasp table robot-hand uses. |
| `grip` | `number` | `0.25` | Hand closure, 0 open to 1 shut. |
| `speed` | `number` | `0.55` | Gait 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. |
| `offset` | `number` | `0` | Seconds of offset, so a crowd of them breaks step. Phase is the cycle here, so the offset has its own name. |
| `interactive` | `boolean` | `false` | Drag across to scrub the gait; arrow keys step it. |
| `onPhaseChange` | `(phase: number) => void` | — | The cycle fraction throughout a drag or a key press. |
| `showGround` | `boolean` | `true` | Draw the contact shadow, which fades in the flight phase. |
| `label` | `string` | — | Caption below the gait 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-skeleton.tsx`
