# Mantis

The one animal in the set with somewhere to reach. The raptorial forelimbs are a two-link chain solved to a real target, so the strike is inverse kinematics and an unreachable goal clamps rather than fails.

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

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

## Notes

- A goal outside the reach clamps onto the reachable circle, the way every arm in the registry does. Drag the pointer off the frame and you get a stretched limb, not a broken one.
- The four walking legs are solved chains too, planted on the ground plane. The blueprint variant draws the forelimb's reach circle.
- The gait is an illustrative footfall trajectory: no balance, no ground reaction, and the animal never travels across the frame.

## Usage

```tsx
import { RobotMantis } from "@/components/ui/robot-mantis"

<RobotMantis behavior="stalk" />

// Or aim the forelimbs yourself, in the animal's own units.
<RobotMantis target={{ x: 46, y: -14 }} phase={0.3} headAngle={20} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One animal, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"stalk" | "strike" | "groom" | "static"` | `"stalk"` | What it does when target is not supplied: folded and swaying, loading and shooting the forelimbs out, or cleaning them across the head. |
| `target` | `{ x: number; y: number }` | — | Where the forelimbs reach, in the animal's own units: x forward from the shoulder, y up. Supplying it stops the pointer and the behavior. |
| `phase` | `number` | — | Controlled cycle fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `0.8` | Cycles per second. |
| `offset` | `number` | `0` | Seconds of offset, so a pair break 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. |
| `stride` | `number` | `0.5` | Walking-leg travel, clamped to 0–1. |
| `headAngle` | `number` | — | Head turn in degrees, clamped to −45..45. |
| `interactive` | `boolean` | `true` | The forelimbs reach for the pointer, and a click snaps the strike out past it. |
| `onStrike` | `() => void` | — | Fired on the click that snaps. |
| `onTargetChange` | `(target: Vec2) => void` | — | Where the forelimbs are aimed, whenever it moves. |
| `showGround` | `boolean` | `true` | The ground line and the shadow. |
| `label` | `string` | — | Caption underneath the animal. |
| `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-mantis.tsx`
