# Tower block

A residential tower with the lift left visible: the car and the counterweight hang on one rope over one sheave, so the weight falls exactly as far as the car rises.

> 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/tower-block.json
```

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

## Notes

- The rope cannot stretch, so the counterweight mirrors the car about mid travel and `hoistPose` reports the total rope length — equal at every position, which is the invariant its test checks rather than believes.
- The storey count is the only structural axis: the height, the facade grid, the landing doors and the travel all come off it, so a four-storey block and a twenty-four-storey one are the same machine.
- The lit windows are a fixed deterministic pattern scaled by occupancy. The same flat lights at the same occupancy every render — there is no dispatching, no call queue, no traffic and no people.
- The aviation lamp is the one thing here on a clock of its own, and it is a lamp rather than a light model.
- A generic residential tower. No building, architect, city or address is reproduced here or in the demo.

## Usage

```tsx
import { TowerBlock } from "@/components/ui/tower-block"

<TowerBlock storeys={14} behavior="service" />

// Or take the car yourself; it reports the storey it is standing at.
<TowerBlock carriage={0.6} onFloorChange={setFloor} />
<TowerBlock interactive cutaway storeys={20} occupancy={0.8} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One tower, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `carriage` | `number` | — | Controlled lift position, 0 at the bottom stop to 1 at the top. Supplying it stops the loop. |
| `behavior` | `"service" | "night" | "static"` | `"service"` | Run the car up the building and back with a dwell at each end, or park it at the ground between two late calls while the building empties. |
| `storeys` | `number` | `12` | Storeys above the podium, rounded and clamped to 4–24. It is the height, the facade grid and the lift's travel at once. |
| `occupancy` | `number` | `0.55` | How much of the building is in, 0 to 1. It scales a fixed pattern of lit windows — it does not model anybody. |
| `cutaway` | `boolean` | `true` | Cut the shaft open so the car, the ropes, the sheave and the counterweight are visible. |
| `crown` | `"mast" | "plant" | "none"` | `"mast"` | What sits on the roof: a plant deck, or a plant deck with a mast and its aviation lamp. |
| `speed` | `number` | `0.16` | Round trips of the car per second. |
| `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. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `interactive` | `boolean` | `false` | Drag up and down to take the car, or arrow-key it a storey at a time. |
| `onCarriageChange` | `(carriage: number) => void` | — | Car position throughout a drag or a key press. |
| `onFloorChange` | `(floor: number) => void` | — | The storey the car is standing at, 0-based, whenever it changes — not every pixel it passes. |
| `showGround` | `boolean` | `true` | Draw the contact shadow beneath the podium. |
| `label` | `string` | — | Caption under the drawing. |
| `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/tower-block.tsx`
