# Clamshell laptop

A portable workstation on one solved hinge. The lid keeps its own length at every angle, and the screen is drawn only from a camera that can actually see 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/clamshell-laptop.json
```

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

## Notes

- The hinge is solved, not tweened. The lid is `lid` long from the pivot in every pose, and the drawing knows when it has passed vertical — which is what lets it decide between drawing the display and drawing the back of it.
- The screen appears only when the camera can see it: shut it is face down on the keyboard, and side on it is a line. Nothing is drawn at a grazing angle, because a sheared screen is a picture of a screen rather than a projection of one.
- Side elevation is the view it is drawn in; the machine is modelled once in world units and pushed through the camera, so the keyboard foreshortens in plan and the lid becomes a slab in profile without any second drawing.
- No friction, no detent, no torque and no balance — there is nothing stopping the lid but `travel`. The keyboard layout is illustrated rather than mapped to any standard.
- An original archetype. No manufacturer, product line, wordmark or paint scheme is reproduced here or in the demo; the display draws structure only.

## Usage

```tsx
import { ClamshellLaptop } from "@/components/ui/clamshell-laptop"

<ClamshellLaptop screen="code" view="iso" />

// Controlled, or a lid you can open yourself.
<ClamshellLaptop lid={105} />
<ClamshellLaptop interactive onLidChange={setAngle} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"profile"` | Where the camera stands. One machine, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `lid` | `number` | — | Controlled lid angle in degrees, 0 shut. Omit it and the hinge runs behavior. |
| `behavior` | `"open" | "adjust" | "static"` | `"open"` | Run a whole session — lift, work, shut — or leave it open and work the angle. |
| `travel` | `number` | `135` | How far the hinge opens, degrees, clamped to 90–150. Ask for more and it stops here. |
| `speed` | `number` | `0.24` | Open-and-shut cycles 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 the lid open, or arrow-key it five degrees at a time. |
| `onLidChange` | `(angle: number) => void` | — | Lid angle in degrees throughout a drag or a key press. |
| `screen` | `"desktop" | "code" | "media" | "off"` | `"desktop"` | What the display is showing. Structure in palette roles — a bar, a window, lines, a dock — never an application's own artwork. |
| `showDesk` | `boolean` | `true` | Draw the contact shadow on the desk. |
| `label` | `string` | — | Caption below the state readout. |
| `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/clamshell-laptop.tsx`
