Stamp the page
Press the stamp and an impression lands on the document with a thump; the page gives a little. Press it again and a fresh strike replaces the last (Approve twice is still one APPROVED).
A button that is a rubber stamp: a wooden knob on an inked die, in the color of the impression it will leave. Press it and APPROVED, PAID or VOID lands on the page with a thump. The stamps on a page are JSON, so they can be state.
npx shadcn@latest add @wobko/stamp-buttonFirst time here? Add the registry to components.json first. How to install
Press the stamp and an impression lands on the document with a thump; the page gives a little. Press it again and a fresh strike replaces the last (Approve twice is still one APPROVED).
The tool takes the color of the pad it will leave: green, red, blue felt, black. Any preset from the sticker sheet works, or give the words and the shape yourself.
A real review step: the stamps are the state. Approving or rejecting leaves its impression on the expense report (a second decision replaces the first), the status badge follows it, and Reset clears the page.
The page that takes stamps: a positioned box holding your document and any number of StampButtons (a footer, a toolbar, anywhere inside). It shows the impressions above its content, gives 2 px under each stamp and announces it politely.
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | StampImpression[] | - | The impressions on the page: { id, press, x, y (fractions of the surface), name or text, shape, ink, turn, seed, … }. Plain JSON; clear it with [] or restore a saved one. |
| onValueChange | (value: StampImpression[]) => void | - | Called on every strike. |
| max | number | - | Keep only the most recent N impressions. |
The tool: pad ink from the preset (or `ink`), a label on the die, a handle on top. Hover lifts the die on a drop-line, press sinks it and inks it heavier. Striking a stamp again replaces its own impression with a new one (own wear, own turn, one in five a double strike).
| Prop | Type | Default | Description |
|---|---|---|---|
| stamp | string | - | A preset from the sticker sheet: stamp-approved, stamp-paid, stamp-void, stamp-urgent, stamp-received, stamp-draft, stamp-new, stamp-member. Other props override it. |
| text / shape / ink / sub / ring / w / h / size / ghost / dashed | as on Stamp | - | The impression, when there is no preset or to change one. `ink` is red, ink-you, green or ink. |
| impressionId | string | - | Names the stamp on the page. The same id replaces its impression instead of adding one. Default the preset or the text. |
| place | { x: number; y: number } | { x: .72, y: .6 } | Where to aim, as fractions of the surface. Every strike wanders up to 3 percent from it. |
| onStamp | (impression: StampImpression) => void | - | Called with the impression that was made. |
| asChild | boolean | false | Draw the tool on your own element. With disabled, the element gets aria-disabled and the stamp does nothing. |
| children | ReactNode | - | The label; default the stamp's word. |
The files the CLI copies into your project.
Loading the source