Chalkboard
A bar or café chalkboard in a mitred wooden frame, with a ledge, chalk and an eraser: headings, notices, lists and menus with prices on dot leaders, hand-written in grainy chalk on slate or green board. The words stay real, selectable text. It can write itself in line by line with a clip reveal, and new content makes the eraser wipe the old words and leave a smudge first. A region named by its label, with write for agents. Caveat from npm (OFL-1.1).
Example
Today's menu
- Leek and potato soup4.50
- Grilled sardines9.80
- Apple crumble5.20
- Dogs welcome on the terrace
Installation
@fontsource-variable/caveat@5.3.0Usage
Reach for it for a menu, a list of specials or notices that should feel hand-written. Prices sit on dot leaders; plain text with one line each is enough to fill it.
API reference
Chalkboard
| Prop | Type | Default |
|---|---|---|
labelrequiredThe board's accessible name: "Today's menu", "Notices". | string | – |
revealWrites each line in by hand, left to right, when it first shows and after every wipe. Never under reduced motion. | boolean | false |
writingSpeedHow fast the hand writes, in characters per second. Default 32. | number | 32 |
surfaceThe board: black `slate` (the default) or a school `green`. | "slate" | "green" | "slate" |
trayShows the wooden ledge with chalk and an eraser under the board. Default true. | boolean | true |
classNameClasses for the frame; a function gets the board's state. | string | ((state: ChalkboardState) => string | undefined) | – |
Also takes ChalkboardOptions.
Other exports
chalkboardchalkboardBlockschalkboardTextchalkColorstype ChalkboardBlocktype ChalkboardContenttype ChalkboardMenuItemtype ChalkboardPropstype ChalkboardStatetype ChalkColortype ChalkboardSurfacetype ChalkboardOptionsAccessibility
- The board is a region named by its label; headings, lists and menu lines are real elements and text, selectable and read in order.
- Dot leaders, the ledge, the chalk and the eraser are hidden from screen readers; a price reads right after its dish.
- While a change wipes the board, the old words leave the reading order at once. Reduced motion shows new words without the writing or the wipe.
Agent actions
Agents find it by its label and call write with text (# heading, - item, Coffee ... 2.50) or blocks; anything else fails the step with what it takes.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.