# Ant

A six-legged forager from above. The spider's carapace is one plate; this body is three sections on a short spine, so a turn runs down the animal instead of pivoting it as a slab.

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

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

## Notes

- Six legs, fixed. The gait solver takes four to ten, but an ant has six and the component does not pretend otherwise.
- The heading bends the body chain rather than rotating the whole drawing, which is what puts the head into a turn before the gaster follows.
- The mandibles, the antennae and the cargo are illustrated linkages. The legs and the body chain are the solved parts.

## Usage

```tsx
import { RobotAnt } from "@/components/ui/robot-ant"

<RobotAnt behavior="forage" />

// Or drive the gait, the course and the jaws yourself.
<RobotAnt phase={0.3} heading={-40} bite={1} cargo="leaf" gaster={0.8} showContacts />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One forager, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"forage" | "haul" | "idle" | "static"` | `"forage"` | What it does when phase is not supplied: a quick tripod casting for a trail, a slow wave gait under a load, or standing and feeling about. |
| `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` | `1.1` | Gait cycles per second. |
| `offset` | `number` | `0` | Seconds of offset, so a column 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.5` | Normalized body clearance, clamped to 0–1. |
| `stride` | `number` | `0.66` | Normalized foot travel, clamped to 0–1. |
| `lift` | `number` | `0.5` | Normalized swing height, clamped to 0–1. |
| `heading` | `number` | — | Course in degrees, which bends the body chain. Omit and the behavior picks. |
| `bite` | `number` | — | Mandible opening, 0 shut to 1 wide. Omit and the behavior works them. |
| `antennae` | `number` | — | Antenna aim, −1..1. Omit and they follow the pointer. |
| `cargo` | `"none" | "crumb" | "leaf"` | `"none"` | What it is carrying over its head. |
| `gaster` | `number` | — | Gaster lift, 0 level to 1 cocked up. Omit and the behavior sets it. |
| `interactive` | `boolean` | `true` | The antennae track the pointer, and a click opens and shuts the mandibles. |
| `onMandibleChange` | `(open: boolean) => void` | — | Fired on the click that works the jaws. |
| `showGround` | `boolean` | `true` | The ground patch under the machine. |
| `showContacts` | `boolean` | `false` | Ring the feet carrying weight. |
| `label` | `string` | — | Caption underneath the forager. |
| `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-ant.tsx`
