The page
Widgets
Examplea whole program
state src = "let n = 1\n"state saved = ""action save(text: string) saved = textcolumn gap=8 padding=16 editor value=src lang="js" change=save height=300 text `${src.length} characters; ${saved.length} saved` color=dimMental model#
The built-in elements, and where each is documented#
editor#
richtext#
Examplea whole program
state doc: json = richtext.from("Hello Ada,")state sent = ""action send sent = richtext.html(doc)column gap=8 padding=16 richtext value=doc placeholder="Write…" aria-label="Message" height=240 button "Send" press=send text sent color=dimterminal#
Examplea whole program
state out = "Welcome\r\n$ "state grid = ""action typed(data: string) out += dataaction sized(s: string) grid = scolumn gap=8 padding=16 terminal output=out input=typed change=sized height=320 text grid color=dimflow#
Examplea whole program
shape Step id: string x: number y: number title: stringshape Wire id: string from: string to: stringstate nodes: Step[] = [{id: "a", x: 0, y: 0, title: "Start"}, {id: "b", x: 320, y: 80, title: "End"}]state edges: Wire[] = [{id: "e1", from: "a", to: "b"}]state locked = falseaction changed(e: string) let ev: json = JSON.parse(e) if ev.type == "move" for m in ev.nodes let hit = nodes.find(s => s.id == m.id) if hit hit.x = m.x hit.y = m.yflow edges=edges locked=locked change=changed height=400 for s in nodes key=s.id view id=s.id data-x=s.x data-y=s.y padding=12 background=card border-radius=8 text s.title view data-panel="top-right" button (locked ? "Unlock" : "Lock") press={locked = !locked}chart#
Examplea whole program
state rows: json = [{x: 1, y: 3}, {x: 2, y: 5}, {x: 3, y: 4}]state seen = ""action heard(e: string) let ev: json = JSON.parse(e) seen = ev.typecolumn gap=8 padding=16 chart data=rows marks=[{kind: "line", y: "y", label: "y"}] x=({col: "x", type: "linear"}) label="A line" change=heard height=200 text seenPitfalls#
Where a new element goes#
In the source#
Edit this page:
docs/widgets.md