# Folding handset

A book-fold handset and the display that has to survive it. The crease is a real bend radius, the sheet keeps its own length, and the leaves roll on the bend rather than pivoting on a pin.

> 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/folding-handset.json
```

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

## Notes

- The display cannot stretch and cannot be creased to a knife edge, so the bend costs `radius × (180 − fold)` of sheet and that length comes off the panels: the display peels away from the inner end of each leaf as the machine shuts. `2 × run + arc` is the sheet's length at every angle, and the peeled strip is the teardrop cavity you can see in the gap.
- The leaves roll on the bend rather than pivoting on a pin — both faces stay tangent to the bend circle, which is what the cams in a water-drop hinge are for, and what leaves the shut leaves `2 × radius` apart with the bend tucked inside instead of pinched flat.
- The panel is rigid whatever the display is doing: hinge to tip is exactly one leaf at every angle. Ask for a bend too big for the leaves and the machine reports `pinched` with the straight run clamped to zero, the way `slate-tablet` reports a stand that cannot reach the desk.
- The solver works in the fold's own symmetric frame; the component turns the whole pose by the swing so one leaf is held still, which is how a hand opens it — and what puts the flat inner display and the shut cover display face-on to the same camera. The one face none of the four cameras can see is the back of the leaf that is held, so nothing is modelled there.
- A display half is drawn only when the camera can see it and is not behind the other leaf: shut, both halves are inside the sandwich. The bend is drawn as the cylinder patch it is, at the two heights of one arc.
- No dynamics — no hinge friction, no detent, no torque, no crease memory, and no material in the sheet beyond its length and its radius. The bend is a circular arc rather than a real teardrop spline, and both displays draw structure only.
- An original archetype. No manufacturer, product line, wordmark or paint scheme is reproduced here or in the demo.

## Usage

```tsx
import { FoldingHandset } from "@/components/ui/folding-handset"

<FoldingHandset screen="split" cover="clock" />

// Controlled, or a machine you can open yourself.
<FoldingHandset fold={108} radius={4} />
<FoldingHandset interactive onFoldChange={setFold} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"front"` | Where the camera stands. One machine, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `fold` | `number` | — | Controlled fold in degrees: 0 shut, 180 flat. Omit it and the fold runs behavior. |
| `behavior` | `"unfold" | "flex" | "static"` | `"unfold"` | Run a whole session — open it, use it, shut it — or leave it half open and work the angle. |
| `travel` | `number` | `180` | How far the hinge opens, degrees, clamped to 90–180. Ask for more and it stops here. |
| `radius` | `number` | `3` | The crease's bend radius in world units, clamped to 1.5–40. It sets the gap the shut machine leaves and the display the bend spends. |
| `speed` | `number` | `0.2` | 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 up inside the frame to open it, or arrow-key it ten degrees at a time. |
| `onFoldChange` | `(fold: number) => void` | — | Fold in degrees throughout a drag or a key press. |
| `screen` | `"canvas" | "split" | "gallery" | "off"` | `"canvas"` | What the inner display is showing. Structure in palette roles, laid out across both leaves — never an application's own artwork. |
| `cover` | `"clock" | "alerts" | "off"` | `"clock"` | What the cover display on the outside of the swinging leaf is showing. |
| `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/folding-handset.tsx`
