# Document (document)

> Folded paper illustration with optional label and accent heading.

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

## Install

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

Also installs @jbm/tokens (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/document.json, files[].content).

| Source path | Installs to | Import |
| --- | --- | --- |
| `registry/jbm/ui/document.tsx` | `src/jbm/ui/document.tsx` | `@/jbm/ui/document` |

## API

### `Document` (component)

Static SVG sheet with a folded top-right corner, a heading stroke, three grey text lines, and an optional mono label. Without a label it is decorative (aria-hidden); with one it is an image named by the label.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | none | Mono filename printed near the bottom edge; also the accessible name. Truncated to 15 characters plus an ellipsis when longer than 16. Omit for a decorative sheet. |
| `accent` | `boolean` | `false` | Draws the heading stroke in vermilion instead of ink. |

Also accepts React.SVGProps<SVGSVGElement>.

## Stage

Declared in stage pixels at the documented defaults.

| Orientation | Width | Height |
| --- | --- | --- |
| Landscape (1920×1080) | 160 | 200 |
| Vertical (1080×1920) | 160 | 200 |

Fixed 160×200 viewBox rendered at width 160 and height 200 stage pixels. The style sets height auto and maxWidth 100%, so set style.width to scale it with its 4:5 proportions; other SVG attributes pass through.

## Examples

### Labelled accent document

```tsx
import { Document } from "@/jbm/ui/document"

<Document label="idea.md" accent style={{ width: 180 }} />
```

### Decorative pair, one tilted

```tsx
import { Document } from "@/jbm/ui/document"

<div style={{ display: "flex", gap: 24 }}>
  <Document style={{ width: "42%" }} />
  <Document label="borrador.md" style={{ width: "42%", transform: "rotate(4deg)" }} />
</div>
```

## QA

- Compare accent and ink headings: only the heading stroke changes color.
- Try a label longer than 16 characters: it ends with an ellipsis and stays inside the sheet.
- Scale with style.width at narrow widths: the fold and ink edge (stroke.outline) keep their 160:200 proportions.
- Without a label the SVG is aria-hidden; with one it exposes role img and the label as its name.

## Family

Paper & writing

## Docs

- [Visual primitives guide](https://jbm-ui.bns.studio/docs/visual-primitives.md)

## Related

Installs:

- [Tokens (tokens)](https://jbm-ui.bns.studio/catalog/tokens.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
