A rectangle: a coloured cell, a card or a panel. It can hold other items, and on_click (or a shorthand such as toggle="$on") makes it clickable.
Holds statements.Holds statements in { }. Scripts only.
AttributeOption
Value
Description
on_click
statements
Runs when it is clicked.
border
a string with { }
A border colour.
toggle
expression
Flips a bool field: toggle: $open is open = not $open. Runs on on_click, like on_click: "toggle: …".
call
expression
Calls a function or one of the component's methods: call: $save, with: [$note.id]. Runs on on_click, like on_click: "call: …".
with
expression
Goes with call:.
increment
expression
Adds 1 (or by:) to a number field: increment: $count, by: 5. Runs on on_click, like on_click: "increment: …".
by
expression
Goes with increment: or decrement:.
decrement
expression
Takes 1 (or by:) from a number field, never going below its min: (stock: int(min: 0)): decrement: $stock. Runs on on_click, like on_click: "decrement: …".
set
expression
Sets a field to a value: set: $tab, to: 'notes'. Runs on on_click, like on_click: "set: …".
to
expression
Goes with set: or add:.
add
expression
Adds a value to a list field: add: $draft, to: $tags. Runs on on_click, like on_click: "add: …".
remove
expression
Removes a value from a list field: remove: $tag, from: $tags. Runs on on_click, like on_click: "remove: …".
from
expression
Goes with remove:.
reset
expression
Puts a field (or a list of fields) back to its declared default: reset: $draft, or reset: [$title, $done]. Runs on on_click, like on_click: "reset: …".
cycle
expression
Moves a field to the next value of its enum, or of a list given with through:, wrapping round: cycle: $view, through: ['list', 'grid']. Runs on on_click, like on_click: "cycle: …".
through
expression
Goes with cycle:.
save
expression
Saves a KScript.Data record: save: $note is $note->save(). Runs on on_click, like on_click: "save: …".
delete
expression
Deletes a KScript.Data record: delete: $note is $note->delete(). Runs on on_click, like on_click: "delete: …".
A button. Its text is the label; on_click runs when it is pressed, or name the action straight on it: toggle="$open".
Holds text with { } values. Scripts only.
AttributeOption
Value
Description
on_click
statements
Runs when the button is pressed, e.g. on_click="$count += 1".
variant
normal|primary
primary makes it stand out.
disabled
expression
true greys it out so it can't be used.
toggle
expression
Flips a bool field: toggle: $open is open = not $open. Runs on on_click, like on_click: "toggle: …".
call
expression
Calls a function or one of the component's methods: call: $save, with: [$note.id]. Runs on on_click, like on_click: "call: …".
with
expression
Goes with call:.
increment
expression
Adds 1 (or by:) to a number field: increment: $count, by: 5. Runs on on_click, like on_click: "increment: …".
by
expression
Goes with increment: or decrement:.
decrement
expression
Takes 1 (or by:) from a number field, never going below its min: (stock: int(min: 0)): decrement: $stock. Runs on on_click, like on_click: "decrement: …".
set
expression
Sets a field to a value: set: $tab, to: 'notes'. Runs on on_click, like on_click: "set: …".
to
expression
Goes with set: or add:.
add
expression
Adds a value to a list field: add: $draft, to: $tags. Runs on on_click, like on_click: "add: …".
remove
expression
Removes a value from a list field: remove: $tag, from: $tags. Runs on on_click, like on_click: "remove: …".
from
expression
Goes with remove:.
reset
expression
Puts a field (or a list of fields) back to its declared default: reset: $draft, or reset: [$title, $done]. Runs on on_click, like on_click: "reset: …".
cycle
expression
Moves a field to the next value of its enum, or of a list given with through:, wrapping round: cycle: $view, through: ['list', 'grid']. Runs on on_click, like on_click: "cycle: …".
through
expression
Goes with cycle:.
save
expression
Saves a KScript.Data record: save: $note is $note->save(). Runs on on_click, like on_click: "save: …".
delete
expression
Deletes a KScript.Data record: delete: $note is $note->delete(). Runs on on_click, like on_click: "delete: …".
A tick box tied to a true/false variable. Its text is the label.
Holds text with { } values. Scripts only.
AttributeOption
Value
Description
bindrequired
a variable's name
The variable it shows and changes. Declare it with <let> directly inside <KScript.Window>.The variable it shows and changes. Declare it with $name = value directly inside <KScript.Window>.
on_change
statements
Runs after the person changes the value ($event.value), e.g. on_change="saved = false".
disabled
expression
true greys it out so it can't be used.
width
expression
Width in pixels.
height
expression
Height in pixels.
padding
expression
Space inside the edge, in pixels.
margin
expression
Space outside the edge, in pixels.
background
a string with { }
A colour: a name such as teal, or #1e293b.
radius
expression
How rounded the corners are, in pixels.
tooltip
a string with { }
Text shown when the pointer rests on it.
Example
<CheckBox bind="wrap">Wrap around the edges</CheckBox>
Self-closing.A statement on its own. Scripts only.
AttributeOption
Value
Description
bindrequired
a variable's name
The variable it shows and changes. Declare it with <let> directly inside <KScript.Window>.The variable it shows and changes. Declare it with $name = value directly inside <KScript.Window>.
optionsrequired
expression
The choices: a list of values, a list of { label, value } maps, or a map from label to value.
on_change
statements
Runs after the person changes the value ($event.value), e.g. on_change="saved = false".
Self-closing.A statement on its own. Scripts only.
AttributeOption
Value
Description
bindrequired
a variable's name
The variable it shows and changes. Declare it with <let> directly inside <KScript.Window>.The variable it shows and changes. Declare it with $name = value directly inside <KScript.Window>.
min
expression
The smallest value (default 0).
max
expression
The largest value (default 100).
step
expression
Snap to multiples of this.
on_change
statements
Runs after the person changes the value ($event.value), e.g. on_change="saved = false".
A box to type in, tied to a variable. on:, trim: and as: say when and how the typed value is stored, as with @bind on a page.
Self-closing.A statement on its own. Scripts only.
AttributeOption
Value
Description
bindrequired
a variable's name
The variable it shows and changes. Declare it with <let> directly inside <KScript.Window>.The variable it shows and changes. Declare it with $name = value directly inside <KScript.Window>.
on
input|change|blur
When the typed value is stored: input (as you type, the default), change or blur (when focus leaves or Enter is pressed).
trim
true or false
true trims spaces from both ends before the value is stored.
as
'string'|'int'|'number'|'bool'
Reads the typed value as this type before it is stored, and refuses one that isn't: as: int.
placeholder
a string with { }
Grey text shown while it is empty.
on_enter
statements
Runs when Enter is pressed.
on_change
statements
Runs after the person changes the value ($event.value), e.g. on_change="saved = false".
Opens a desktop window. Its direct <let>, <fn> and <import> children run once and hold its state; the rest is the layout, drawn again after every on_* handler. The script continues when the window is closed.Opens a desktop window. Its direct $name = value, fn and import children run once and hold its state; the rest is the layout, drawn again after every on_* handler. The script continues when the window is closed.
Holds statements.Holds statements in { }. Scripts only.
AttributeOption
Value
Description
title
a string with { }
The title bar text.
width
expression
Starting width in pixels (default 800).
height
expression
Starting height in pixels (default 600).
theme
dark|light|system
dark, light or system (the default).
background
a string with { }
The window's colour.
padding
expression
Space around the layout, in pixels (default 16).
gap
expression
Space between the window's top-level items (default 12).