Widget pages
A widget page is a public page for one of your widgets, at /w/<name>/<id>. Anyone can open it without signing in, so it's the link to share on social media or Discord. It's separate from the Workshop. A widget only has a page if you create one.
Create a page
- Publish the widget first. A page can't go live until the widget is published.
- In the Widget Creator, open Page and click Create page.
- Design the page (see below), then click Save page.
- Turn on Page is live. Until you do, the page is hidden.
Use Copy link to share it, or View page to open it in a new tab.
What visitors see
- A live preview of your published widget. Nothing plays until visitors press a button.
- One demo button for each demo your widget defines, directly on the preview.
- An Actual size / Fill switch on the preview. Fill stretches a resizable widget to the preview (within its size limits) or zooms a fixed-size one. The Start tab sets which one the page opens with; the default is Actual size.
- Widget Properties, a sidebar where visitors try their own settings. Visitors can't change images and sounds there.
- Under the preview, About, Gallery and Links, with More by you beside them. Empty sections are left out.
- Related widgets along the bottom: other authors' public widgets that have a page, similar ones first. Private widgets' pages don't show them.
- A header bar that stays in view: the Community logo, the widget's name with its author (linking to their profile), its licence, and the Install with Community button. The header bar and footer can't be changed.
Design the page
The Page surface has these tabs:
| Tab | What it does |
|---|---|
| Theme | Accent colour, background, light or dark mode, and the preview backdrop. |
| CSS | Your own styles for the preview and sections. See Custom CSS. |
| Content | The link name, the About text (Markdown), gallery images and links. |
| Demos | The demos your widget defines, each with a Test button. |
| Start | The values the preview opens with. |
Demos
Register a demo with defineDemo(label, run) and the page shows a button for it. This example sends three chat messages, 100 ms apart:
defineDemo("Spam chat", async ({ wait, chatter }) => {
for (const text of ["one", "two", "three"]) {
simulateEvent(Event.Chat, { text, ...chatter() });
await wait(100);
}
});
wait(ms)pauses the demo, andchatter()gives a varied fake chatter (name and colour) for chat events.- Register demos while the widget loads, in top-level code or
onLoad. Labels are unique, a widget can have up to 12 demos, and a label can be up to 60 characters. Add a tooltip withdefineDemo(label, run, { description: "..." }). - Demos run on the widget page and in the Widget Creator only, never on stream.
- Reset restarts the widget, which also stops every running demo.
- Events sent from a demo skip dynamic properties, so a
{{...}}value in a property isn't filled in during a demo.
The first six demos show on the preview and the rest go under More. A widget with no demos gets one button per event it reacts to, each firing a sample.
The Demos tab lists your published widget's demos, each with a Test button that runs it on the page preview. Edit your code to change them. A demo added to the draft appears after you publish. To try draft demos first, use the Demos section on the Simulate tab, which has a Run button for each.
Demo template
A container widget, such as a bounce area, has no child widgets on a page, so its preview is an empty box. Call showDemoTemplate(Template.Demo) in onLoad to show a placeholder of your own instead. Without it the page shows your showTemplate template.
onLoad(() => {
showTemplate(Template.Main);
showDemoTemplate(Template.Demo);
});
Once showDemoTemplate is called, later showTemplate calls are ignored on the page. If your widget swaps templates on events, call both: showTemplate(Template.Alert); showDemoTemplate(Template.Alert);. The Page view switch above the Widget Creator preview shows your draft as its page does.
Start values
The Simulate tab has a Use as page start shortcut. It saves the current test properties and size as the preview's starting values. Anything unset uses the property's default.
A page isn't connected to a stream, so bound stream values (title, counts, goals, credits, the ad schedule and so on) start with placeholders. Page view in the Widget Creator shows them too.
Private widgets
A private widget's page works the same, and anyone with the link can use the preview. Installing still needs the share code, which visitors enter on the page after signing in.
Custom CSS
Sections carry a data-block attribute: about, gallery, links, more-by-author, remixed-from and related. A remixed widget's page shows a "Remixed from" section (remixed-from) just before Related widgets: a link to the original's page when it is public and live, otherwise its name and author as plain text.
The two columns carry data-region: main (About, Gallery, Links) and side (More by you).
The preview's parts carry data-el: preview, preview-fit, demo-button and properties-sidebar.
[data-block="gallery"] { gap: 16px; }
[data-el="demo-button"] { border-radius: 999px; }
The site's header bar and footer can't be restyled.
Use your widget's images
Upload images in the Widget Creator's Assets tab, then use them in CSS with url($alias). The alias is the image's name without the extension, lowercased, with spaces and symbols turned into dashes. Hero Image.png becomes $hero-image:
.host { background-image: url($hero-image); }
The CSS tab lists each image with its alias and a Copy button. New images work on the page after you publish.