Practical examples. Live demos.

Pick an example to open it full screen, with the live preview and its source side by side.

API

13

One small demo per building block, the same ones the docs embed.

09

Tag Builders

A builder takes attributes, static children and dynamic text. Rename changes the state, then calls update().

API
10

Components

A component is a plain function. Each Counter() call keeps its own count.

API
11

Attributes

Attribute values can be functions. The second button flips busy and calls update(); Save's disabled and aria-busy follow.

API
12

Events

onInput and onKeyDown are plain attributes. Type, then press Escape to clear.

API
13

Lifecycle

onMount starts an interval and returns its cleanup. Unmount runs the cleanup, so the count pauses until the timer mounts again.

API
14

Explicit Updates

count++ only changes the variable. The text catches up on the next update(), from the button or anything else on this page.

API
15

Dynamic Values

Edit the name. The static text was fixed when the element was built; the dynamic one runs again on every update(). forceUpdate() rebuilds the tree, so the static text catches up too.

API
16

update()

Every update() runs every dynamic value, even when its data did not change. Other demos on this page push the count up too.

API
17

scope()

Both buttons add an item and rename the user. update('cart') refreshes only the scoped panel.

API
18

when()

The first true condition wins; otherwise .else() renders. A new branch is built from scratch.

API
19

list()

Rows are matched by identity. Check a row, then Reverse: the same <li> moves, checkbox and all.

API
20

region() & into()

A layout with a stacked main region and a side region, filled from outside it. Type into Home, open the dialog and close it: the text stays. Article fills both regions with one into().

API
21

forceUpdate()

update() refreshes only the dynamic lang line. forceUpdate() calls App again and patches the same <h1>. The explicit form rebuilds only this tree, not the whole page.

API