Using widgets

How to put a widget in a page: its props, its content, when it is a block and when it sits inside a paragraph, and what happens when one fails. It is a task article under Widgets.

Props and content

kind="tip" is a string, a value in braces is a JavaScript expression, and the Markdown between the tags is the content.

Tag names are matched exactly, and only names of known widgets are widgets: a capitalized tag that names no widget is a problem, shown as an error in its place, never passed through as HTML; a lowercase tag is ordinary HTML.

Block or inline

A widget that has its lines to itself — nothing before its open tag, nothing after its close tag — is a block. Anywhere else it is part of the paragraph around it, at the start of a line included:

⌘ P prints the doc, one paragraph, bold and all.

On paper

A PDF, and the browser's print, show each widget's first render — what it shows before anyone clicks: a Tabs prints its first tab. A widget meant for paper shows what matters without interaction (A PDF is the page the browser shows). devpage pdf waits for every widget to mount before printing.

When a widget fails

The rest of the page always renders. These are problems — in the page's problems bar, on the terminal, and failing devpage check:

A widget, or one of its prop expressions, that throws while rendering is shown in the widget's place, with the error, in the browser. devpage never runs widget code on the server, so neither the problems bar nor devpage check can see it.