Components

Paper

A sheet of paper on the desk: a stock (paper, slip, index card, graph, kraft, sticky notes ...), an edge (cut, torn, deckle, pinked ...), printed rules, a shadow and a small seeded tilt. The sheet turns; your content never does.

Install

terminal
npx shadcn@latest add @wobko/paper

First time here? Add the registry to components.json first. How to install

Examples

Stocks

Paper is a recipe: a color, a tooth, a shadow and the rules printed on it. Each stock lies at its own small angle.

Edges

A plain cut is pure CSS. Torn, deckled, pinked, perforated and scalloped edges draw their outline once, with a fringe of torn fibers.

Taped, pinned, clipped

The `tape` shorthand lays strips across a corner, along the top or across both corners. A `fastener` holds a sheet with a clip, a pin, a staple or a binder clip.

Ruled notes

Printed rules are part of the sheet, so they turn with it and the text stays upright. Set the line height to the rule pitch (28 px) and start the first line 16 px down (p-4) and the words sit on the lines, baseline 2 to 3 px above the rule. Each rule is printed 8 px above the bottom of its line; --ll-rule-offset tunes that.

A wall of sticky notes

Sticky notes are turned a little more than pages, cast a shadow that lifts at the foot, and can curl a corner. One note per meaning; the first word says what it is.

A receipt

Thermal paper with pinked top and bottom, a mono print and a dashed total. The `receipt` stock is the same recipe as every other, cut differently.

API reference

Paper

A container whose background is drawn paper. A plain cut edge is pure CSS (baked tooth tiles, a lit gradient, an umber shadow stack): no SVG at all. A torn, deckled, crimped, pinked, perforated or scalloped edge is the same CSS sheet cut to a drawn outline (`clip-path`), with a small svg of plain paths for the fiber fringe and the edge line: no texture lives in the svg, so a page of drawn sheets costs what a page of cut ones does. Everything behind the content turns together by `--ll-tilt`; children are upright. A drawn edge is a few px larger than the box on every side (the fringe) and a turned sheet's corners swing by half its width times the angle, so a sheet that ends flush with the window (a full-width page, a sheet at the very bottom) can scroll it by that much: put it in a container with `overflow-x-clip` (`overflow-clip` at the bottom), or lay it square with `tilt={false}`.

PropTypeDefaultDescription
stock"paper" | "card" | "slip" | "index-card" | "graph" | "dot-grid" | "check" | "ledger" | "pad" | "kraft" | "napkin" | "sticky-yellow" | "sticky-green" | "sticky-orange" | "sticky-pink" | "sticky-blue" | "photo" | "parchment" | "receipt""paper"What the sheet is made of: its color token, tooth, shadow stack, default edge and printed rules.
edge"cut" | "torn" | "deckle" | "crimp" | "zig" | "perf" | "scallop" | { top?, right?, bottom?, left? }the stock's ownHow it is cut. One kind, or one per side (missing sides are cut). Anything but `cut` cuts the sheet to a drawn outline; until it has a size the sheet shows as a cut CSS sheet.
tiltboolean | numbertruetrue: a seeded angle within the stock's limit (never under a quarter of it, clamped to --ll-tilt-max, zero in calm density). A number is degrees. false lays it square.
rules"none" | "ruled" | "ruled-hand" | "index" | "graph" | "dots" | "ledger" | "pad" | "window"the stock's ownPrinted rules on the sheet: blue lines and a red margin (`ruled` is gradients, `ruled-hand` is a light svg of wandering pencil lines), an index card's red header rule, graph cells, a dot grid, a ledger, an order pad's lines. One decorative element of CSS gradients; ruled stocks tilt less so text stays on the lines. Text sits on `ruled` (28 px pitch), `pad` and `index` (30) and `ledger` (24) rules when its line-height is the pitch and a line box ends where the first rule's line does (`ruled`: 16 px of padding, then 28 px lines): each rule is printed `--ll-rule-offset` above the bottom of its line box (default 8 px for `ruled`, 9 for `pad` and `index`, 6 for `ledger`), which is where a hand font's baseline leaves room for the rule to run 2 to 3 px under it. Set `--ll-rule-offset` on the sheet or any ancestor to tune it; the script role sits lower in its line box, lift it by the offset less about 3 px.
tape"corner" | "top" | "both" | falsefalseTape strips across one top corner, along the top edge, or across both top corners.
tapeKindTapeKind"masking"Which tape: masking, washi-dots, washi-stripes, washi-zigzag, washi-gingham, kraft, clear.
fastener"clip" | "pin" | "staple" | "binder-clip" | falsefalseHolds the sheet with a drawn prop that has a lit stroke and a short warm shadow.
fastenerTone"steel" | "tomato" | "tangerine" | "lemon" | "grass" | "teal" | "sky" | "grape" | "bubblegum"-Color of the clip's plastic coating or the pin's head.
fastenerClassNamestring-Classes for the fastener, merged after its default place (a clip stands at `-top-5 right-8`, a pin at `-top-2 left-1/2`), so `right-[3.125rem]` slides a clip along the top edge and `-top-8` lifts it. Use it to keep a fastener off a control at the sheet's corner.
shadow"stock" | "none" | "hair" | "loose" | "lift" | "slip" | "card" | "pad" | "check" | "paper" | "sticky""stock"The umber shadow stack. Calm density swaps it for a hairline. A drawn edge casts the stack's soft layers from a rectangle inset to the mean of its edge, and its tight layer as a hairline that follows the edge.
curlbooleanfalseA sticky note's curling bottom-right corner: the sheet is chamfered and the lifted flap is drawn into it, so it turns and casts with the sheet.
as"div" | "section" | "article" | "aside" | "header" | "footer" | "main" | "nav" | "li" | "ul" | "ol" | "form" | "fieldset" | "figure""div"The element to render.
seedstring | number-Pins the hand: the same seed always cuts, tilts and textures the sheet the same way. Default: derived from useId().
size[number, number]-The sheet's size in px, if you know it. A drawn edge is then part of the server markup instead of appearing after the first measure.

Fastener

A paper clip, push-pin, staple or binder clip as a free-standing prop. Intrinsic size, complete in server markup; place it with className.

PropTypeDefaultDescription
kind"clip" | "pin" | "staple" | "binder-clip""clip"Which fastener.
tone"steel" | Accent-Clip coating or pin head color.
sizenumber-Clip height, pin head diameter, staple length or binder clip width in px.
seedstring | number-Pins the drawing.

PaperDefs

The paper tiles as SVG `<pattern>`s, for static svg art of your own that wants paper texture. A `Paper` needs none of it: torn, deckled and pinked sheets wear the tiles as CSS backgrounds, cached once per tile by the browser. Do not fill per-instance svgs with these patterns; every instance rasterizes its own copy.

PropTypeDefaultDescription
tilesPaperTileName[]fiber, relief, slip, kraft, cloudWhich tiles to define.

Accessibility

  • A CSS sheet brings the tooth tiles of its stock itself (one deduplicated `<style>` per tile, in the server HTML too), so it needs no provider. Saturated sticky notes lay a veil of their own color over the tooth, so orange and pink read as paper, not plaster.
  • The sheet, its rules, tape and fasteners are decoration: the drawing is aria-hidden, pointer-events: none and never focusable. Paper adds no role; give it one (`as="article"`, `role="region"` with a label) when the content deserves it.
  • Text is ink on paper (14:1 on paper, 9.4:1 on kraft, at least 9:1 on every sticky note) and stays upright: only the sheet and its rules turn.
  • Tilt is clamped to --ll-tilt-max and is zero in calm density and in reduced-motion contexts that set it; props are hidden in calm density.
  • In Windows high contrast the drawn svg (fiber fringe, edge line) steps aside and the host gets a real 1px outline; the paper stays cut to its edge, and tape stays visible.

Source

The files the CLI copies into your project.

Loading the source