A collection of embeddable Notion widgets hosted on Val Town, allowing you to serve interactive UI directly within your Notion pagesβno external servers required.
This repo demonstrates how to build, deploy, and embed serverless widgets using Val Town Projects. Widgets include:
base_widget.ts) β Example static HTML/JS exportclick_counter.tsx) β Persistent click counter using blob storagedice_roller.ts) β D&D-style expression roller with history and clear functionalityadvanced_dice_roller.tsx) β Adds presets, advantage/disadvantage, keep/drop, exploding dicenotionWidgets/ ββ base_widget.ts # Minimal example of a static UI val ββ click_counter.tsx # Click counter with blob persistence ββ dice_roller.ts # Simple expression-based dice roller ββ advanced_dice_roller.tsx # Full-featured dice roller with advanced mechanics ββ README.md # This documentation
/embedClone or Remix this project in Val Town:
Click Remix on the project page, or
Use the Val Town CLI:
vt clone <username>/notionWidgets cd notionWidgets vt push
Publish your project (ensure itβs public or unlisted).
Access each widget at:
https://<your-username>.val.run/<file-name-without-extension>
/click_counter, /dice_roller, /advanced_dice_rollerEmbed in Notion:
/embed β Embed URL.https://<username>.val.run/dice_roller).A minimal example exporting a static HTML page via a default export.
/ (UI), /count (GET/POST API)std/blob for persistent { count }Routes: /, /roll, /history, /clear
Parsing: NdM+K expressions
UI: Input + roll button + history list + clear history
Improvements:
BASE detection via window.location.pathnameAdvanced Mechanics:
advdM / disdMNdM!NdMkhK / NdMklK (e.g. 4d6kh3)UI Enhancements:
BASE from window.location.pathname for embedsblob.getJSON / blob.setJSON for stateful dataparseExpression() covering multiple RPG mechanicsEnjoy building and embedding your own custom Notion widgets with Val Town! Feel free to extend and remix this template.