# Turtle

A plodder from above: the shared gait solver at four legs on a slow wave, under a procedurally plated carapace, with one number that pulls the head, tail and every foot in underneath it.

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

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

## Notes

- Retraction is geometry rather than a fade: the limbs really do come in, and the carapace is drawn after them, so it covers what has been pulled underneath.
- The scutes are laid out from the shell's own dimensions — five vertebrals, four costals a side, and a marginal ring — so a resized carapace re-plates itself.
- Four legs is the low end of the shared gait solver, which always allowed it and had never been asked. The carapace dome only reads off-axis.

## Usage

```tsx
import { RobotTurtle } from "@/components/ui/robot-turtle"

<RobotTurtle behavior="plod" />

// Or drive the gait and the retraction yourself.
<RobotTurtle phase={0.3} retract={0.8} gaze={0.4} showContacts />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One plodder, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"plod" | "bask" | "retract" | "static"` | `"plod"` | What it does when phase is not supplied: one leg at a time, sitting with the neck out, or shut up entirely. |
| `gait` | `string` | — | Footfall pattern: stand, tripod, wave or ripple. Omit and the behavior picks one. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `0.45` | Gait cycles per second. |
| `offset` | `number` | `0` | Seconds of offset, so a line of them 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. |
| `height` | `number` | `0.35` | Normalized body clearance, clamped to 0–1. |
| `stride` | `number` | `0.55` | Normalized foot travel, clamped to 0–1. |
| `lift` | `number` | `0.4` | Normalized swing height, clamped to 0–1. |
| `heading` | `number` | `0` | Which way the shell faces, in degrees. |
| `retract` | `number` | — | Retraction, 0 fully out to 1 everything under the shell. Omit and the behavior sets it. |
| `gaze` | `number` | — | Head aim, −1..1. Omit and it follows the pointer. |
| `interactive` | `boolean` | `true` | The head tracks the pointer, and a click pulls everything in or lets it back out. |
| `onRetractChange` | `(withdrawn: boolean) => void` | — | Fired on the click that withdraws or emerges. |
| `showGround` | `boolean` | `true` | The ground patch under the machine. |
| `showContacts` | `boolean` | `false` | Ring the feet carrying weight. |
| `label` | `string` | — | Caption underneath the plodder. |
| `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-turtle.tsx`
