# Crab

A sideways walker from above: the same gait solver as the spider turned across the body, plus two hinged claws and a pair of tracking eyestalks.

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

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

## Notes

- Plan view is the identity projection. Off-axis the legs are the solve at its own heights, the carapace has a real thickness and the chelipeds are tubes rather than outlines.
- The carapace never turns: only the travel direction handed to the gait solver does, which is the whole mechanical difference between this and the spider.
- Claws are illustrated linkages with one solved degree of freedom — the hinged jaw. The walking legs are the solved part.

## Usage

```tsx
import { RobotCrab } from "@/components/ui/robot-crab"

<RobotCrab behavior="scuttle" />

// Or drive the cycle, the course and the claws yourself.
<RobotCrab phase={0.25} heading={270} claw={0.8} eyes={-0.5} showContacts />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One walker, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"scuttle" | "idle" | "static"` | `"scuttle"` | What it does when phase is not supplied: runs one way, stops, runs back, or stands and works its claws. |
| `gait` | `"stand" | "tripod" | "wave" | "ripple"` | — | Footfall pattern. Omit and the behavior picks one. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the internal clock. Wraps in both directions. |
| `speed` | `number` | `1` | Gait cycles per second. |
| `offset` | `number` | `0` | Seconds of offset, so a colony breaks step. |
| `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. |
| `legs` | `number` | `8` | Walking legs, rounded to an even number and clamped to 4–10. The claws are extra. |
| `height` | `number` | `0.4` | Normalized body clearance, clamped to 0–1. |
| `stride` | `number` | `0.7` | Normalized foot travel, clamped to 0–1. |
| `lift` | `number` | `0.55` | Normalized swing height, clamped to 0–1. |
| `heading` | `number` | — | Travel direction in degrees across the body: 90 runs to starboard, 270 to port. Omit and the behavior picks. |
| `claw` | `number` | — | Claw opening, 0 shut to 1 wide. Omit and the behavior works them. |
| `eyes` | `number` | — | Eyestalk aim, −1..1. Omit and the stalks follow the pointer. |
| `interactive` | `boolean` | `true` | The stalks track the pointer, and a click snaps both claws shut and lets them fall open. |
| `onSnap` | `() => void` | — | Fired on the click that snaps the claws. |
| `showGround` | `boolean` | `true` | The ground patch under the machine. |
| `showContacts` | `boolean` | `false` | Ring the feet carrying weight. |
| `label` | `string` | — | Caption underneath the robot. |
| `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-crab.tsx`
