# Bat

A membrane flyer in profile. Four finger struts fan off the wrist of a three-link arm and the skin is drawn through their tips, so furling and beating deform one surface instead of swapping artwork.

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

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

## Notes

- Hanging and flying are one body rotated by flight, not two drawings. Everything is written for the flying pose and turned over into the roost.
- The membrane is the boundary the strut tips describe, with the scalloped trailing edge a bat actually has. Move a finger and the skin follows, because there is nothing else for it to follow.
- The wing is an angle-driven linkage rather than an inverse-kinematic solve: there is no target for a wing to reach.

## Usage

```tsx
import { RobotBat } from "@/components/ui/robot-bat"

<RobotBat behavior="roost" />

// Or drive the beat and the posture yourself.
<RobotBat phase={0.3} spread={1} flight={1} headAngle={-20} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One bat, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `behavior` | `"roost" | "flap" | "glide" | "static"` | `"roost"` | What it does when phase is not supplied: hang furled from the beam, beat, or hold the skin out. |
| `phase` | `number` | — | Controlled wingbeat fraction. Supplying it stops the internal clock. |
| `speed` | `number` | `2.2` | Wingbeats 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. |
| `spread` | `number` | — | Wing extension, 0 furled against the body to 1 spread. Omit and the behavior sets it. |
| `flight` | `number` | — | 0 hanging head-down from the beam, 1 airborne and the right way up. Omit and the behavior decides. |
| `headAngle` | `number` | — | Head turn in degrees, clamped to −40..40. Omit and it follows the pointer. |
| `interactive` | `boolean` | `true` | The head tracks the pointer, and a click drops it off the beam for a circuit before it climbs back. |
| `onDrop` | `() => void` | — | Fired on the click that starts a sortie. |
| `showGround` | `boolean` | `true` | The roosting beam. |
| `label` | `string` | — | Caption underneath the bat. |
| `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-bat.tsx`
