# Escritorio (escritorio)

> An empty desk with separate finish and optional file cabinet.

- Entry: component
- Category: UI Bits
- Preview capabilities: controls
- Runtime: React
- Needs Remotion: no
- QA page: https://jbm-ui.bns.studio/c/escritorio
- JSON: https://jbm-ui.bns.studio/catalog/escritorio.json
- Registry item: https://jbm-ui.bns.studio/r/escritorio.json (source code in files[].content)

## Install

```sh
npx shadcn@latest add @jbm/escritorio
```

Also installs @jbm/tokens, @jbm/scene-geometry, @jbm/cajon, @jbm/file-cabinet (registry dependencies install automatically).

## Required setup

1. Add the `@jbm` registry to components.json (keep any entries already there):

   ```json
   {
     "registries": {
       "@jbm": "https://jbm-ui.bns.studio/r/{name}.json"
     }
   }
   ```

2. Map `@/*` to `./src/*` in tsconfig.json `compilerOptions.paths`, so `@/jbm/…` imports resolve to src/jbm/.

## Files

Each file's source code is in the registry item JSON (https://jbm-ui.bns.studio/r/escritorio.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/motion/escritorio.tsx` | `src/jbm/motion/escritorio.tsx` | `@/jbm/motion/escritorio` |

## API

### `Escritorio` (component)

SVG <g> of an empty desk (slab, apron, and two legs) sized to a box, with a paper or wood finish and an optional file cabinet between the legs. The cabinet body is drawn behind the desk and its drawer (Cajón) in front, so drawer folders can rise over the apron. Controlled; no internal timer. Render inside an <svg>.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `box` | `Box` | required | Desk bounds { x, y, w, h } in the parent SVG's user units. The top slab starts at y + 2 and the legs reach the floor at y + h. |
| `spec` | `DeskSpec` | none | Finish and cabinet side: finish paper (card fill, default) or wood (bg fill with grain lines); drawerSide start (left, default) or end (right). |
| `cabinet` | `boolean` | none | Shows the file cabinet and its drawer under the desk. |
| `folders` | `readonly DrawerFolder[]` | none | Folders in the cabinet drawer, as for Cajón: name, accent, and pulled per folder, index 0 nearest the front. |
| `open` | `number` | none | Cabinet drawer opening from 0 (closed) to 1 (open). Clamped. |

### `escritorioLayout` (function)

Shared desk geometry: the cabinet fits between the legs (at most 250 wide, 12 units of clearance) from below the apron to the floor.

| Parameter | Type | Default | Description |
| --- | --- | --- | --- |
| `box` | `Box` | required | Desk bounds { x, y, w, h } in the parent SVG's user units. The top slab starts at y + 2 and the legs reach the floor at y + h. |
| `spec` | `DeskSpec` | `{}` | Only drawerSide affects the layout; finish is visual. |
| `cabinet` | `boolean` | none | Accepted for parity with Escritorio's props; the layout always computes cabinet and drawer geometry. |
| `folders` | `readonly DrawerFolder[]` | `[]` | Folders in the cabinet drawer, as for Cajón: name, accent, and pulled per folder, index 0 nearest the front. |
| `open` | `number` | `0` | Cabinet drawer opening from 0 (closed) to 1 (open). Clamped. |

Returns: { box, top, cabinet, drawer, plane, anchors }: top is box.y + 20; cabinet and drawer are the FileCabinet and Cajón props; plane holds innerLeft, innerRight, floor, and apronBottom; anchors.folders are the folder tab grip points, all in parent SVG units.

### `DeskSpec` (type)

{ finish?: "paper" | "wood"; drawerSide?: "start" | "end" }.

## Stage

Declared in stage pixels at the documented defaults.

| Orientation | Width | Height |
| --- | --- | --- |
| Landscape (1920×1080) | 760 | 418 |
| Vertical (1080×1920) | 760 | 418 |

Parent SVG user units for the documented box 760 × 420: width is box.w and height runs from the slab top at box.y + 2 to the floor at box.y + box.h (box.h − 2). A lifted folder in an open cabinet drawer can rise above the slab, so leave headroom when pulled is used.

## Examples

### Wood desk with a cabinet on the right

```tsx
import { Escritorio } from "@/jbm/motion/escritorio"

<svg viewBox="0 0 820 530">
  <Escritorio box={{ x: 30, y: 65, w: 760, h: 420 }}
    cabinet spec={{ finish: "wood", drawerSide: "end" }}
    folders={[{ name: "datos", accent: true }, { name: "notas" }]} open={1} />
</svg>
```

### Reach for a folder with a hand

```tsx
import { Escritorio, escritorioLayout } from "@/jbm/motion/escritorio"
import { Mano } from "@/jbm/motion/mano" // install @jbm/mano separately

const desk = { box: { x: 30, y: 65, w: 760, h: 420 }, cabinet: true, folders: [{ name: "datos" }], open: 1 }
const tab = escritorioLayout(desk).anchors.folders[0]
<svg viewBox="0 0 820 530">
  <Escritorio {...desk} />
  <Mano at={tab} pose="pinch" size={120} anchor={{ x: 15, y: 5 }} />
</svg>
```

## QA

- Toggle Wood finish: only fills and grain lines change; geometry stays put.
- Toggle File cabinet and Cabinet on right: the cabinet sits between the legs with equal clearance on both sides and shares the floor line.
- With the cabinet on, drag Open and change folder count: the drawer front stays above the floor and folders draw over the apron without clipping.
- Try a narrow box: the cabinet shrinks to fit between the legs; very small widths are untested and may collapse it.
- The Mano anchor in the second example is an estimate of the pinch fingertip; verify it visually.

## Family

Desk objects

## Docs

- [Desk illustrations guide](https://jbm-ui.bns.studio/docs/desk-components.md)

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.md)
- [SceneGeometry (scene-geometry)](https://jbm-ui.bns.studio/catalog/scene-geometry.md)
- [Cajon (cajon)](https://jbm-ui.bns.studio/catalog/cajon.md)
- [FileCabinet (file-cabinet)](https://jbm-ui.bns.studio/catalog/file-cabinet.md)

Imported in examples:

- [Mano (mano)](https://jbm-ui.bns.studio/catalog/mano.md)

## More

- [llms.txt](https://jbm-ui.bns.studio/llms.txt): index of every item
- [catalog.json](https://jbm-ui.bns.studio/catalog.json): every item as JSON
- [Agent contract](https://jbm-ui.bns.studio/docs/agent-contract.md): what each field means
