DatumHueEnterprise v0.0.24datumhue.com
Contents

DHML

DHML elements

Document pages come in two forms producing the same result: .dhml pages are markdown prose whose kdl fences hold element islands, and .kdl pages are one declarative element tree under a top-level page node.

file:book() loads a single page and dir:book() loads a directory whose book.kdl lists the title and chapters. A script-free book ships as a content_type "book" asset pack any app can open; a book that opens itself is a kind "app" package whose init.lua mounts its own bundle with pkg:dir():book():mount{}. Give an element an id (every element accepts one) and the hosting app reaches its live handle via book:element; markdown headings are addressable the same way through their slug.

kdl
page title="Solar output" {
    column gap=8 {
        label "Daily production" font_size=24
        chart id="solar" height=300 {
            line color="#e67e80" width=2 {
                point x=0 y=12.5
                point x=1 y=14.1
            }
        }
        button id="refresh" "Refresh"
    }
}

The same page written as markdown:

dhml
# Solar output

Daily production, with the *peak* day **highlighted**.

![Site photo](assets/array.png)

```kdl
chart id="solar" height=300 {
    line color="#e67e80" width=2 {
        point x=0 y=12.5
        point x=1 y=14.1
    }
}
```

The same chart as a listing, shown but not run:

```kdl source
chart id="solar" height=300 { }
```

A button you can read and click:

```kdl echo
button id="refresh" "Refresh"
```

Those two forms can be the chapters of a book. A book.kdl at the book's root names the title and lists the chapters in reading order; each file is a page (.dhml or .kdl) relative to the book directory:

kdl
title "Solar output"
chapter "Markdown" file="chapters/markdown.dhml"
chapter "KDL page" file="chapters/kdl.kdl"

Prose and string/number properties may carry {{ expression }} templates: Lua expressions evaluated against the hosting app's globals on every render (mount, go, refresh). A property that is exactly one template keeps the value's own type, so height="{{ h }}" can stand in for a number; an unclosed {{ is left as literal text. A page loaded with bytes:book() runs templates only when its options turn templates on; otherwise its prose shows {{ }} as written, and an if, a for or a property that holds a template raises at load. A lua fence — or a script node, which may load an external script file="..." — runs once at load, and a kdl fence is an element island; an optional mode word makes either fence a listing instead — source shows the code without running it, and echo shows the listing and keeps the block live. Inline code and every other fenced language stay verbatim. The if / for nodes render conditionally and per-item; include splices another page in at load, and a markdown image (![alt](path)) embeds an asset resolved against the book directory, so it needs a directory-loaded book.

For example, this page sets up its data in a load-time lua fence, then renders it: greeting the current user, doubling a running total, repeating a row per series item, and gating a detail chart on a flag:

dhml
# Live readings

```lua
user = { name = "Ada" }
total = 21
base = 10
series = { { name = "edge", value = 3 }, { name = "core", value = 7 } }
show_detail = true
refresh = function() end
```

```kdl
column gap=8 {
    label "Hello, {{ user.name }}"
    label "Total: {{ total * 2 }} kWh" font_size="{{ base + 6 }}"
    button "Refresh" on_click="{{ refresh }}"
    for var="s" in="series" {
        label "{{ s.name }}: {{ s.value }}"
    }
    if cond="show_detail" {
        chart id="detail" height=160 {
            line color="#7fbbb3" width=3 {
                point x=0 y=3
                point x=1 y=7
                point x=2 y=5
            }
        }
    }
}
```

Layout and style properties are the ui.NodeStyle fields, restricted to the shapes a KDL scalar can carry; color-valued properties take hex literals.

Elements 41

button

DHML

A button; the positional argument is the label. Give it an id and bind on_click from the hosting app via book:element.

Takes no children.

Lua constructor: UiElement:button.

AttributeTypeDefaultDescription
value requiredstring | Messagethe button is a card, whose content is the elements created under itButton label — a plain string, or a datumhue.i18n.t(...) message that follows the active locale.
accessible_labelstring | Messagethe label's text names the buttonThe name assistive technology announces, in place of the label's text. Required without text. A datumhue.i18n.t(...) message follows the active locale.
focusableboolean#trueWhether the button takes focus: a navigation stop with a focus ring. false leaves it activated by pointer and touch only; it keeps its accessible name.
enabledboolean#trueWhether the button starts enabled. A disabled button is grayed out and ignores clicks and keyboard activation until elem.enabled = true.
keep_input_focusboolean#falseWhether pressing the button leaves a focused text input of your app focused, keeping its caret, its selection and a phone's on-screen keyboard. Otherwise the press takes focus from the input, as a press anywhere outside it does.
on_click{{ expression }}no defaultClick callback.
on_hover{{ expression }}no defaultCalled when a pointer (the mouse or a touch) enters the button or any of its descendants.
on_hover_exit{{ expression }}no defaultCalled when the last pointer leaves the button and all of its descendants; a press held inside it keeps it entered until the press ends.
on_press{{ expression }}no defaultCalled when a pointer (the mouse or a touch) presses the button with its primary button.
on_release{{ expression }}no defaultCalled when that press ends: released anywhere, or taken by a drag, a drag scroll or a long press.
on_double_click{{ expression }}no defaultCalled on a double-click: two presses on the button within the double-click window.

Plus the layout and style properties.

chart

DHML

A chart plot hosted on an auto-sized canvas; the mark children draw on it.

Children: line, points, area, rule, band, bars, histogram, heatmap, box, histogram2d, text only.

Plus the layout and style properties.

area

DHMLinside chart

A filled-area mark on the enclosing chart; point children are its data.

Children: point only.

Lua constructor: PlotArea:area.

AttributeTypeDefaultDescription
baselinenumber0Numeric baseline the area fills to.
series_columnstringone seriesCategory column splitting rows into one series per distinct value (data sources only). Each series draws as its own area, takes a color from color_scale or the category palette in first-seen order, and contributes its own legend item.
color_scale{{ expression }}the category paletteCategory color scale assigning per-series colors; requires series_column.
readout"interpolate" | "nearest""interpolate"Crosshair readout interpolation mode.
color"#rrggbb"the theme's chart-label color at half opacity, restyled on a theme switchFill color.
points{{ expression }}the data or view sourceInline points, an array of vec2s.
data{{ expression }}the points or view sourceBind to a tabular data source.
view{{ expression }}the points or data sourceBind to a streaming data view.
x_columnstringthe call raises with dataX column name of a data source.
y_columnstringthe call raises with dataY column name of a data source.
x_scale{{ expression }}the area's x scaleX scale.
y_scale{{ expression }}the area's y scaleY scale.
namestringno name; automatic legends skip the markLegend name.
max_pointsnumberevery point is keptMost points an inline-points mark keeps: past it, each Mark:push_point drops the oldest.
on_error{{ expression }}no defaultCalled when the data source fails to load.

band

DHMLinside chart

A filled region on the enclosing chart spanning [from, to] on one axis.

Takes no children.

Lua constructor: PlotArea:band.

AttributeTypeDefaultDescription
axis required"x" | "y"no defaultAxis the [from, to] range spans.
from requirednumberno defaultRange start (data space).
to requirednumberno defaultRange end (data space).
color"#rrggbb"the theme's chart-label color at 20% opacity, restyled on a theme switchFill color.

bar

DHMLinside chart

One category of the enclosing bars mark.

Takes no children.

AttributeTypeDefaultDescription
category requiredstringno defaultCategory label.
value requirednumberno defaultBar height (data space).

bars

DHMLinside chart

A bar mark on the enclosing chart; nest bar children for one series, or series children (each holding bar children) to group them.

Children: bar, series only.

Lua constructor: PlotArea:bars.

AttributeTypeDefaultDescription
entries{{ expression }}the series or data sourceArray of {category, value} entries. Exactly one of entries, series, or data.
series{{ expression }}the entries or data sourceArray of {name?, color?, entries} series for stacked/grouped layouts; a series without a color takes the category palette's. Requires mode.
data{{ expression }}the entries or series sourceTabular source; requires category_column. Bars aggregate per category — no row becomes a Lua table. Rows with a null category or value are skipped.
category_columnstringthe call raises with dataCategory column to group by (data sources).
value_columnstringonly the count aggregateNumeric column to aggregate; required for every aggregate except count.
series_columnstringone seriesCategory column splitting rows into one series per distinct value (data sources). Requires mode; series take palette colors in first-seen order.
aggregate"sum" | "mean" | "min" | "max" | "count"sum with a value_column, count without onePer-category aggregation for data sources.
mode"stacked" | "grouped"one series; the call raises with series or series_columnMulti-series layout. Stacked accumulates per category from the baseline (negatives stack downward); grouped subdivides each band per series.
group_paddingnumber0.1Gap between grouped sub-bars as a 0..1 fraction.
orientation"vertical" | "horizontal""vertical"Bar orientation.
color"#rrggbb"the theme's chart-label color, restyled on a theme switchBar color.
baselinenumber0Numeric baseline the bars grow from.
namestringno name; automatic legends skip the markLegend name.
x_scale{{ expression }}the area's x scaleX scale.
y_scale{{ expression }}the area's y scaleY scale.

box

DHMLinside chart

A box-and-whisker mark on the enclosing chart; box-entry children are its per-category five-number summaries.

Children: box-entry only.

Lua constructor: PlotArea:box.

AttributeTypeDefaultDescription
entries{{ expression }}the data sourcePre-computed summaries (low/high are the whisker ends). Exactly one of entries or data.
data{{ expression }}the entries sourceTabular source; requires category_column and value_column. Summaries take quartiles by linear interpolation, whiskers at the farthest values inside the 1.5 IQR fences, and the rest as outliers.
category_columnstringthe call raises with dataCategory column to group by (data sources).
value_columnstringthe call raises with dataNumeric column to summarize (data sources).
box_widthnumber0.6Box width as a 0..1 fraction of the band slot.
orientation"vertical" | "horizontal""vertical"Box orientation. The category axis is x when vertical, y when horizontal.
color"#rrggbb"the theme's chart-label color, restyled on a theme switchBox and whisker color.
median_color"#rrggbb""#000000"Median line color.
outlier_color"#rrggbb"the box colorOutlier point color.
namestringno name; automatic legends skip the markLegend name.
x_scale{{ expression }}the area's x scaleX scale. Discovered categories append to the band scale on the category axis.
y_scale{{ expression }}the area's y scaleY scale.

box-entry

DHMLinside chart

One per-category five-number summary of the enclosing box mark (low <= q1 <= median <= q3 <= high).

Children: outlier only.

AttributeTypeDefaultDescription
category requiredstringno defaultCategory label.
low requirednumberno defaultLower whisker.
q1 requirednumberno defaultFirst quartile.
median requirednumberno defaultMedian.
q3 requirednumberno defaultThird quartile.
high requirednumberno defaultUpper whisker.

cell

DHMLinside chart

One categorical cell of the enclosing heatmap.

Takes no children.

AttributeTypeDefaultDescription
x requiredstringno defaultX-axis category.
y requiredstringno defaultY-axis category.
value requirednumberno defaultCell magnitude.

heatmap

DHMLinside chart

A categorical heatmap on the enclosing chart; cell children are its data.

Children: cell only.

Lua constructor: PlotArea:heatmap.

AttributeTypeDefaultDescription
cells{{ expression }}the matrix or data sourceArray of {x, y, value} cells (x/y are category strings). Exactly one of cells, matrix, or data.
matrix{{ expression }}the cells or data sourceRow-major {{number, ...}, ...} values; requires x_categories and y_categories (row index follows y_categories).
x_categories{{ expression }}the call raises with matrixColumn categories for matrix.
y_categories{{ expression }}the call raises with matrixRow categories for matrix.
data{{ expression }}the cells or matrix sourceTabular source; requires x_column and y_column. Cells aggregate per category pair.
x_columnstringthe call raises with dataCategory column for cell columns (data sources).
y_columnstringthe call raises with dataCategory column for cell rows (data sources).
value_columnstringonly the count aggregateValue column to aggregate; required for sum/mean.
aggregate"count" | "sum" | "mean"mean with a value_column, count without oneCell aggregation for data sources.
color_scale required{{ expression }}no defaultMaps cell values to colors. A pending domain fits the cell extent and keeps tracking it.
namestringno name; automatic legends skip the markLegend name.
x_scale{{ expression }}the area's x scaleBand scale for columns. Discovered categories are appended in first-seen order.
y_scale{{ expression }}the area's y scaleBand scale for rows. Discovered categories are appended in first-seen order.

Plus the layout and style properties.

histogram

DHMLinside chart

A histogram on the enclosing chart; value children are the samples to bin.

Children: value only.

Lua constructor: PlotArea:histogram.

AttributeTypeDefaultDescription
values{{ expression }}the data sourceInline values to bin. Exactly one of values or data.
data{{ expression }}the values sourceTabular source; requires column. Binning reads the column — no row becomes a Lua table.
columnstringthe call raises with dataColumn to bin (data sources).
binsnumber | string"auto", or the bin_width spacing when that is setBin count, or "auto" for width-by-spread with a count floor. Mutually exclusive with bin_width.
bin_widthnumberthe spacing bins givesExplicit bin width in data units. Mutually exclusive with bins.
normalize"count" | "fraction" | "density""count"Bar heights.
range{{ expression }}the data extent{min, max} bin extent; a zoomed x scale re-bins over the visible domain.
color"#rrggbb"the theme's chart-label color, restyled on a theme switchBar color.
namestringno name; automatic legends skip the markLegend name.
x_scale{{ expression }}the area's x scaleX scale.
y_scale{{ expression }}the area's y scaleY scale.

histogram2d

DHMLinside chart

A 2D density heatmap on the enclosing chart; point children are the (x, y) samples to bin.

Children: point only.

Lua constructor: PlotArea:histogram2d.

AttributeTypeDefaultDescription
points{{ expression }}the data sourceInline vec2 points to bin. Exactly one of points or data.
data{{ expression }}the points sourceTabular source; requires x_column and y_column.
x_columnstringthe call raises with dataNumeric column for x (data sources).
y_columnstringthe call raises with dataNumeric column for y (data sources).
x_binsnumber | string"auto"Bin count for x, or "auto".
y_binsnumber | string"auto"Bin count for y, or "auto".
normalize"count" | "fraction""count"Cell values.
color_scale required{{ expression }}no defaultMaps cell values to colors. A pending domain fits the cell extent and keeps tracking it across zoom re-bins.
namestringno name; automatic legends skip the markLegend name.
x_scale{{ expression }}the area's x scaleNumeric x scale.
y_scale{{ expression }}the area's y scaleNumeric y scale.

Plus the layout and style properties.

line

DHMLinside chart

A line mark on the enclosing chart; point children are its data.

Children: point only.

Lua constructor: PlotArea:line.

AttributeTypeDefaultDescription
series_columnstringone seriesCategory column splitting rows into one series per distinct value (data sources only). Each series draws as its own line, takes a color from color_scale or the category palette in first-seen order, and contributes its own legend item.
color_scale{{ expression }}the category paletteCategory color scale assigning per-series colors; requires series_column.
readout"interpolate" | "nearest""interpolate"Crosshair readout interpolation mode.
points{{ expression }}the data or view sourceInline points, an array of vec2s.
data{{ expression }}the points or view sourceBind to a tabular data source.
view{{ expression }}the points or data sourceBind to a streaming data view.
x_columnstringthe call raises with dataX column name of a data source.
y_columnstringthe call raises with dataY column name of a data source.
x_scale{{ expression }}the area's x scaleX scale.
y_scale{{ expression }}the area's y scaleY scale.
color"#rrggbb"the theme's chart-label color, restyled on a theme switchMark color.
namestringno name; automatic legends skip the markLegend name.
max_pointsnumberevery point is keptMost points an inline-points mark keeps: past it, each Mark:push_point drops the oldest.
on_error{{ expression }}no defaultCalled when the data source fails to load.

Plus the layout and style properties.

outlier

DHMLinside chart

One outlier sample of the enclosing box entry.

Takes no children.

AttributeTypeDefaultDescription
value requirednumberno defaultThe outlier value (data space).

point

DHMLinside chart

One data point of the enclosing mark.

Takes no children.

AttributeTypeDefaultDescription
x requirednumberno defaultX value (data space).
y requirednumberno defaultY value (data space).

points

DHMLinside chart

A scatter (dots) mark on the enclosing chart; point children are its data.

Children: point only.

Lua constructor: PlotArea:points.

AttributeTypeDefaultDescription
sizenumber4Dot size.
size_columnstringevery dot takes sizeColumn driving per-dot size.
size_scale{{ expression }}the call raises with size_columnScale whose domain normalizes size_column values.
size_range{{ expression }}the call raises with size_column{min, max} output dot sizes in pixels for size_column values.
color_columnstringevery dot takes colorColumn driving per-dot color.
color_scale{{ expression }}the call raises with color_columnColor scale for color_column. A ramp whose domain is pending fits the column's extent once the data loads, and again when Mark:replace_data swaps the data.
points{{ expression }}the data or view sourceInline points, an array of vec2s.
data{{ expression }}the points or view sourceBind to a tabular data source.
view{{ expression }}the points or data sourceBind to a streaming data view.
x_columnstringthe call raises with dataX column name of a data source.
y_columnstringthe call raises with dataY column name of a data source.
x_scale{{ expression }}the area's x scaleX scale.
y_scale{{ expression }}the area's y scaleY scale.
color"#rrggbb"the theme's chart-label color, restyled on a theme switchMark color.
namestringno name; automatic legends skip the markLegend name.
max_pointsnumberevery point is keptMost points an inline-points mark keeps: past it, each Mark:push_point drops the oldest.
on_error{{ expression }}no defaultCalled when the data source fails to load.

rule

DHMLinside chart

A reference line on the enclosing chart at a data-space value.

Takes no children.

Lua constructor: PlotArea:rule.

AttributeTypeDefaultDescription
orientation required"vertical" | "horizontal"no defaultReference-line direction.
value requirednumber | stringno defaultData-space position of the line. A category name resolves to the band scale's slot center when the mark is created; raises when the axis scale isn't a band scale or the category is unknown.
color"#rrggbb"the theme's chart-label color, restyled on a theme switchLine color.
value_labelstringno labelLabel drawn at the line.

Plus the layout and style properties.

series

DHMLinside chart

One named series of the enclosing bars mark; its bar children are its categories.

Children: bar only.

AttributeTypeDefaultDescription
namestringno defaultLegend name.
color"#rrggbb"no defaultSeries color.

text

DHMLinside chart

A text annotation on the enclosing chart at a data-space (x, y). x / y / offset_x / offset_y are read as literal numbers (a templated value falls back to 0), like the other inline-data props.

Takes no children.

AttributeTypeDefaultDescription
x requirednumberno defaultX position (data space).
y requirednumberno defaultY position (data space).
text requiredstringno defaultAnnotation text.
color"#rrggbb"no defaultText color.
font_sizenumber | stringno defaultFont size — a number (px) or a unit string.
align"center" | "top_left" | "top_center" | "top_right" | "center_left" | "center_right" | "bottom_left" | "bottom_center" | "bottom_right"no defaultAnchor of the text box relative to (x, y).
offset_xnumberno defaultPixel offset X from (x, y).
offset_ynumberno defaultPixel offset Y from (x, y).

value

DHMLinside chart

One sample value to bin in the enclosing histogram.

Takes no children.

AttributeTypeDefaultDescription
n requirednumberno defaultThe sample value (data space).

checkbox

DHML

A checkbox; the positional argument is the label. Bind on_change from the hosting app via book:element.

Takes no children.

Lua constructor: UiElement:checkbox.

AttributeTypeDefaultDescription
valuestringa bare checkboxLabel shown beside the box.
checkedboolean#falseWhether it starts checked.
enabledboolean#trueWhether it starts enabled. A disabled checkbox ignores clicks and keyboard toggling until elem.enabled = true.
on_change{{ expression }}no defaultCalled with the new checked state (boolean) each time the user toggles it. A programmatic elem.checked = ... write does not fire it.

Plus the layout and style properties.

column

DHML

A panel with column flex direction.

Children: any element.

Lua constructor: UiElement:panel.

AttributeTypeDefaultDescription
color"#rrggbb"the theme's panel background, following theme switchesBackground color. Pass a datumhue.theme.token(...) to follow the theme and repaint on change.
material{{ expression }}the panel's plain backgroundShader material applied to the panel.
on_hover{{ expression }}no defaultCalled when a pointer (the mouse or a touch) enters the panel or any of its descendants.
on_hover_exit{{ expression }}no defaultCalled when the last pointer leaves the panel and all of its descendants; a press held inside it keeps it entered until the press ends.
on_press{{ expression }}no defaultCalled when a pointer (the mouse or a touch) presses the panel with its primary button.
on_release{{ expression }}no defaultCalled when that press ends: released anywhere, or taken by a drag, a drag scroll or a long press.
on_double_click{{ expression }}no defaultCalled on a double-click: two presses on the panel within the double-click window.

Plus the layout and style properties.

for

DHML

Renders its children once per item of in, binding var.

Children: any element.

AttributeTypeDefaultDescription
var requiredstringno defaultLoop variable name.
in requiredstringno defaultA Lua expression evaluating to an array table.

if

DHML

Renders its children when cond evaluates truthy.

Children: any element.

AttributeTypeDefaultDescription
cond requiredstringno defaultA Lua expression; false / nil drop the children.

include

DHML

Splices another page's blocks in place; the path is relative to the book directory.

Takes no children.

AttributeTypeDefaultDescription
file requiredstringno defaultPage path inside the book.

label

DHML

A text label; the positional argument is the content.

Takes no children.

Lua constructor: UiElement:label.

AttributeTypeDefaultDescription
valuestring | Messagean empty labelText content — a plain string, or a datumhue.i18n.t(...) message that follows the active locale and re-renders when it changes.
font_sizenumber | stringthe theme's normal text size, following theme switchesFont size: a number (pixels) or a unit string like "1.5rem"/ "50vw"/"4vmin".
color"#rrggbb"the theme's text color, following theme switchesText color. Pass a datumhue.theme.token(...) to follow the theme and repaint on change.
strikethroughboolean#falseDraw a line through the text. Also a read/write property.
underlineboolean#falseDraw a line under the text. Also a read/write property.
font_weightnumberthe theme's normal text weight, following theme switchesFont weight: a number on the variable weight axis, or a weight name (bold is the heaviest).
font_style"normal" | "italic" | "oblique""normal"Font face: upright, the calligraphic cursive, or a mechanical slant.
font{{ expression }}the app's default faceFont (a bytes:font() / datumhue.font.builtin() handle); pins this label's face over the one the app sets as its default font.
ligaturesboolean#trueWhether the font may join signs such as >= or -> into one shape. False draws each character as typed, in the text and in any element inside the label.
max_linesnumberno line limitThe most lines the label shows, at least 1. A longer text ends in "..." on the last line, cut at a glyph; a word wider than the label breaks at a glyph. Also a read/write property.
overflow_wrap"break_word" | "normal""break_word"How the label breaks a word wider than itself; max_lines and marquee break their own way while set. Also a read/write property.

Plus the layout and style properties.

link

DHML

A link; the positional argument is the text and url is the destination. Clicking opens it in a new browser tab.

Takes no children.

Lua constructor: UiElement:link.

AttributeTypeDefaultDescription

Plus the layout and style properties.

list

DHML

A selectable list. Provide its rows either by binding items to a Lua array via {{ }}, or by listing inline item children whose labels become the rows (children take priority).

Children: item only.

AttributeTypeDefaultDescription
items{{ expression }}no defaultRow labels as a Lua array (alternative to inline item children).
selectednumberno default1-based index of the initially-selected row.
multibooleanno defaultAllow selecting multiple rows at once (default false).
enabledbooleanno defaultWhether the list accepts input (default true).
on_change{{ expression }}no defaultfun(selected) called on user selection (an index, or an index array when multi).

Plus the layout and style properties.

item

DHMLinside list

One row of the enclosing list; the positional argument is its label.

Takes no children.

AttributeTypeDefaultDescription
value requiredstringno defaultThe row label.

menu

DHML

A dropdown menu; label names the trigger button and child elements become the menu items.

Children: any element.

Lua constructor: UiElement:menu.

AttributeTypeDefaultDescription
label requiredstringno defaultThe menu button's label.
enabledboolean#trueWhether it starts enabled.

Plus the layout and style properties.

number_input

DHML

A numeric input with -/+ steppers. Bind on_change from the hosting app via book:element.

Takes no children.

Lua constructor: UiElement:number_input.

AttributeTypeDefaultDescription
valuenumbermin, or 0 without a minInitial value, clamped to the range.
minnumberthe value is unbounded belowMinimum value.
maxnumberthe value is unbounded aboveMaximum value.
stepnumber1Amount the -/+ steppers add or subtract.
precisionnumber0Decimal places the value is displayed and snapped to, 0..10.
enabledboolean#trueWhether it starts enabled. A disabled number input ignores typing and the steppers until elem.enabled = true.
on_change{{ expression }}no defaultCalled with the new value (number) when the user edits the field or uses a stepper. A programmatic elem.value = ... write does not fire it.

Plus the layout and style properties.

open_button

DHML

A button that opens a file/directory picker on click; the positional argument is the label. Give it an id and bind on_pick from the hosting app via book:element.

Takes no children.

Lua constructor: UiElement:open_button.

AttributeTypeDefaultDescription
value requiredstring | Messageno defaultButton label (required) — a plain string, or a datumhue.i18n.t(...) message that follows the active locale.
mode required"file" | "files" | "dir"no defaultWhat the click picks; selects the on_pick payload.
filters{{ expression }}every file showsFile-type filters, an array of {label, {ext, ...}} pairs. Valid only for file modes; raises with a directory mode.
start_dir{{ expression }}the dialog's own starting locationSeeds the dialog's starting location. Best-effort: native dialogs open there; browser pickers ignore it.
titlestringthe dialog's own titleDialog title.
on_pick{{ expression }}no defaultCalled on a successful pick with the picked handle (never on cancel). Optional; bind later with elem:on_pick (e.g. from a hosting app via book:element). With no handler bound a click opens no dialog.
enabledboolean#trueWhether the button starts enabled. Setting false grays it out and ignores clicks.

Plus the layout and style properties.

panel

DHML

A container panel; children lay out by the flex style props.

Children: any element.

Lua constructor: UiElement:panel.

AttributeTypeDefaultDescription
color"#rrggbb"the theme's panel background, following theme switchesBackground color. Pass a datumhue.theme.token(...) to follow the theme and repaint on change.
material{{ expression }}the panel's plain backgroundShader material applied to the panel.
on_hover{{ expression }}no defaultCalled when a pointer (the mouse or a touch) enters the panel or any of its descendants.
on_hover_exit{{ expression }}no defaultCalled when the last pointer leaves the panel and all of its descendants; a press held inside it keeps it entered until the press ends.
on_press{{ expression }}no defaultCalled when a pointer (the mouse or a touch) presses the panel with its primary button.
on_release{{ expression }}no defaultCalled when that press ends: released anywhere, or taken by a drag, a drag scroll or a long press.
on_double_click{{ expression }}no defaultCalled on a double-click: two presses on the panel within the double-click window.

Plus the layout and style properties.

popover

DHML

A floating popover anchored to its parent element; fill it with child elements and show it via visible.

Children: any element.

Lua constructor: UiElement:popover.

AttributeTypeDefaultDescription
side"top" | "bottom" | "left" | "right""bottom"Which side of the anchor to place it. Auto-flips to the opposite side if it would clip the window.
align"start" | "center" | "end""start"Alignment along the axis perpendicular to side.
visibleboolean#falseWhether it starts shown; toggle later via the visible property.
light_dismissboolean#falseClose the popover on a pointer press outside it. Off: fully app-controlled via the visible property. On: light-dismisses like a menu (pressing the anchor still toggles it).
navigation"auto" | "modal" | "none""auto"How it scopes focus navigation in your app. Light dismiss works the same in each.

Plus the layout and style properties.

radio_group

DHML

A radio group. Provide its options either by binding options to a Lua array via {{ }}, or by listing inline radio children whose labels become the options (children take priority).

Children: radio only.

AttributeTypeDefaultDescription
options{{ expression }}no defaultOption labels as a Lua array (alternative to inline radio children).
selectednumberno default1-based index of the initially-selected option.
accessible_labelstring | Messageno defaultThe name assistive technology announces for the group. A datumhue.i18n.t(...) message bound with {{ }} follows the active locale.
enabledbooleanno defaultWhether the group accepts input (default true).
on_change{{ expression }}no defaultfun(index) called with the 1-based selected index on user selection.

Plus the layout and style properties.

radio

DHMLinside radio_group

One option of the enclosing radio group; the positional argument is its label.

Takes no children.

AttributeTypeDefaultDescription
value requiredstringno defaultThe option label.

row

DHML

A panel with row flex direction.

Children: any element.

Lua constructor: UiElement:panel.

AttributeTypeDefaultDescription
color"#rrggbb"the theme's panel background, following theme switchesBackground color. Pass a datumhue.theme.token(...) to follow the theme and repaint on change.
material{{ expression }}the panel's plain backgroundShader material applied to the panel.
on_hover{{ expression }}no defaultCalled when a pointer (the mouse or a touch) enters the panel or any of its descendants.
on_hover_exit{{ expression }}no defaultCalled when the last pointer leaves the panel and all of its descendants; a press held inside it keeps it entered until the press ends.
on_press{{ expression }}no defaultCalled when a pointer (the mouse or a touch) presses the panel with its primary button.
on_release{{ expression }}no defaultCalled when that press ends: released anywhere, or taken by a drag, a drag scroll or a long press.
on_double_click{{ expression }}no defaultCalled on a double-click: two presses on the panel within the double-click window.

Plus the layout and style properties.

save_button

DHML

A button that opens a save dialog on click; the positional argument is the label. Give it an id and bind on_save / on_save_source from the hosting app via book:element.

Takes no children.

Lua constructor: UiElement:save_button.

AttributeTypeDefaultDescription
value requiredstring | Messageno defaultButton label (required) — a plain string, or a datumhue.i18n.t(...) message that follows the active locale.
sourcestringa click does nothing until elem:on_save_source sets a payloadThe bytes to write, captured now. The write is atomic, on the one click. Bind them later with elem:on_save_source instead to keep the payload current.
suggested_namestringthe dialog pre-fills no nameFilename pre-filled in the save dialog.
filters{{ expression }}every file showsFile-type filters, an array of {label, {ext, ...}} pairs.
start_dir{{ expression }}the dialog's own starting locationSeeds the dialog's starting location. Best-effort: native dialogs open there; browser pickers ignore it.
titlestringthe dialog's own titleDialog title.
on_save{{ expression }}no defaultCalled after the bytes are committed to the chosen file, with the read-only File handle (never on cancel). Optional; bind later with elem:on_save.
enabledboolean#trueWhether the button starts enabled.

Plus the layout and style properties.

slider

DHML

A horizontal slider. Bind on_change from the hosting app via book:element.

Takes no children.

Lua constructor: UiElement:slider.

AttributeTypeDefaultDescription
valuenumberthe range midpointInitial value, clamped to [min, max].
minnumber0Range minimum.
maxnumber1Range maximum.
stepnumber0.1Keyboard / track-click step increment.
enabledboolean#trueWhether it starts enabled. A disabled slider ignores drag and keyboard input until elem.enabled = true.
on_change{{ expression }}no defaultCalled with the new value (number) continuously as the user drags or steps it. A programmatic elem.value = ... write does not fire it.

Plus the layout and style properties.

slot

DHML

A named empty container the hosting app fills via book:element — mount canvases, scenes, or any UI into it.

Takes no children.

Lua constructor: UiElement:panel.

AttributeTypeDefaultDescription
color"#rrggbb"the theme's panel background, following theme switchesBackground color. Pass a datumhue.theme.token(...) to follow the theme and repaint on change.
material{{ expression }}the panel's plain backgroundShader material applied to the panel.
on_hover{{ expression }}no defaultCalled when a pointer (the mouse or a touch) enters the panel or any of its descendants.
on_hover_exit{{ expression }}no defaultCalled when the last pointer leaves the panel and all of its descendants; a press held inside it keeps it entered until the press ends.
on_press{{ expression }}no defaultCalled when a pointer (the mouse or a touch) presses the panel with its primary button.
on_release{{ expression }}no defaultCalled when that press ends: released anywhere, or taken by a drag, a drag scroll or a long press.
on_double_click{{ expression }}no defaultCalled on a double-click: two presses on the panel within the double-click window.

Plus the layout and style properties.

text_input

DHML

A text input field; value seeds it and placeholder shows while empty.

Takes no children.

Lua constructor: UiElement:text_input.

AttributeTypeDefaultDescription
valuestring""Initial text content. Read/write later via the text property.
placeholderstringthe empty field shows no placeholderPlaceholder shown while the field is empty.
accessible_labelstring | Messagethe input has no name of its ownThe name assistive technology announces for the input; its placeholder is not announced in its place. A datumhue.i18n.t(...) message follows the active locale. Also a read/write property.
leading_icon{{ expression }}no iconAn image drawn inside the field's border at its start, one text line tall, as a mask in the theme's secondary text color; a press on it focuses the field. Also a read/write property.
clearableboolean#falseShow a clear button at the field's end while it holds text. Raises on a multi-line input. Also a read/write property.
max_lengthnumberno length limitMaximum number of characters the field accepts; a negative number sets no limit.
multilineboolean#falseAllow multiple lines: Enter inserts a newline instead of submitting.
tab_spacesnumberTab moves focus, as on every other inputOn a multi-line input, Tab types this many spaces at the caret, or over a selection of part of a line. With a whole line or several lines selected, it adds them to the start of each of those lines that is not empty. Shift+Tab takes up to as many off the start of each line the selection or the caret is on. Escape leaves the input. Raises on a single-line input, or for a number below 1 or above 16.
syntax"lua"plain text in the input's text colorColors the text as source code of this language as it is typed, in the theme's syntax_* colors. In a multi-line input, Enter starts the new line indented as the line above it; a single-line input still calls on_submit on Enter. A disabled input shows its text in one color.
line_numbersboolean#falseNumbers the lines in a column at the input's start that scrolls with the text; a wrapped line is numbered on its first row. After the numbers the column keeps room for one more character, where line_marks show their signs. Raises on a single-line input, with leading_icon, and when padding gives the start a percentage.
ligaturesboolean#trueWhether the font may join signs such as >= or -> into one shape. False draws each character as typed, in the text, the placeholder, the line numbers and any element inside the input.
filterstringevery character can be typedA Lua character-class pattern (e.g. "%d", "[%d.-]") restricting which characters can be typed or pasted, matched per character. It masks the character *set*, not structure: validate the whole value in on_change or on_submit (and prefer number_input for numbers). ASCII-oriented like Lua's own %-classes; raises if the pattern is malformed.
purpose"text" | "search" | "email" | "url" | "number""text"What the field holds, which picks a browser's on-screen keyboard and the label of its Enter key. A filter that takes only digits, or digits and both decimal separators, wins: the field keeps its digit keypad and the purpose changes nothing. It never limits what can be typed; outside a browser it changes nothing.
select_all_on_focusboolean#falseSelect all the text when the field gains keyboard focus.
enabledboolean#trueWhether it starts enabled. A disabled input ignores keyboard and pointer input until elem.enabled = true.
on_change{{ expression }}no defaultCalled with the new text (string) on each user edit. A programmatic elem.text = ... write does not fire it.
on_submit{{ expression }}no defaultCalled with the text (string) when Enter is pressed in a single-line input.
autofocusboolean#falseTake keyboard focus as soon as the input is created, as focus() does: created while its app is not the input owner, it moves no keys and is the focus the app gets back once it is. If several inputs request it in one frame, the last one created wins.
on_focus{{ expression }}no defaultCalled when keyboard focus enters the input, as on_focus.
on_blur{{ expression }}no defaultCalled when keyboard focus leaves the input (clicking away, Tab, or the app losing focus), as on_blur.
on_cancel{{ expression }}no defaultCalled when a cancel request reaches the focused input: Escape (also while datumhue.ui.focus_navigation is off), gamepad B or Back. The input then loses focus, so the next request goes on past it.

Plus the layout and style properties.

Layout & style properties 34

Shared by every visual element: the same names and values as the fields of ui.NodeStyle. Omitted keys keep the element's own layout and theme style.

AttributeTypeDescription
leftnumber | stringLeft anchor (px or "%").
rightnumber | stringRight anchor (px or "%").
topnumber | stringTop anchor (px or "%").
bottomnumber | stringBottom anchor (px or "%").
widthnumber | stringWidth (px or "%").
heightnumber | stringHeight (px or "%").
min_widthnumber | stringMinimum width.
max_widthnumber | stringMaximum width.
min_heightnumber | stringMinimum height.
max_heightnumber | stringMaximum height.
aspect_rationumberWidth over height. An automatic width or height follows the other size through the ratio, and a minimum or maximum set on only the other axis carries over to it.
marginnumber | stringOuter margin: scalar, string, or {top,bottom,left,right}; a table's missing sides are 0.
paddingnumber | stringInner padding: scalar, string, or {top,bottom,left,right}; a table's missing sides are 0.
bordernumber | stringBorder widths: scalar, string, or {top,bottom,left,right}; a table's missing sides are 0.
flex_grownumberFlex grow factor.
flex_shrinknumberFlex shrink factor.
flex_basisnumber | stringFlex basis (px or "%").
align_self"auto" | "start" | "end" | "flex_start" | "flex_end" | "center" | "baseline" | "stretch"Per-item cross-axis alignment.
flex_direction"row" | "row_reverse" | "column" | "column_reverse"Main-axis direction.
flex_wrap"nowrap" | "wrap" | "wrap_reverse"Wrapping behavior.
justify_content"default" | "start" | "end" | "flex_start" | "flex_end" | "center" | "stretch" | "space_between" | "space_around" | "space_evenly"Main-axis distribution.
align_items"default" | "start" | "end" | "flex_start" | "flex_end" | "center" | "baseline" | "stretch"Cross-axis alignment of items.
align_content"default" | "start" | "end" | "flex_start" | "flex_end" | "center" | "stretch" | "space_between" | "space_around" | "space_evenly"Cross-axis distribution of wrapped lines.
gapnumber | stringShorthand for row_gap + column_gap.
row_gapnumber | stringRow gap (overrides gap).
column_gapnumber | stringColumn gap (overrides gap).
overflow"visible" | "clip" | "clip_x" | "clip_y" | "hidden" | "scroll" | "scroll_x" | "scroll_y"Overflow handling. The scroll variants make the element a wheel-scrollable container; see the scroll / scroll_max element properties.
display"flex" | "grid" | "block" | "none"Display mode. grid places children in the columns grid_template_columns gives, one column without it.
grid_template_columnsnumberThe columns of a grid element. Its children fill them a row at a time, in child order, and a short last row keeps its columns' widths. A count, from 1 to 10000, gives that many columns sharing the width equally. A list gives one column per entry: a UI length other than "auto", "max_content" for a column as wide as its widest child, or "<n>fr" for n shares of the width the other columns and the gaps leave. A shared column never narrows below 0 px, so content wider than it overflows it. {} leaves one column.
border_color"#rrggbb"Border color. Pass a datumhue.theme.token(...) to follow the theme and repaint on change.
border_radiusnumber | stringCorner rounding: scalar, string, or per-corner table.
z_indexnumberStacking order.
outline{{ expression }}Focus outline.
box_shadow{{ expression }}Drop shadow: one shadow, or an array drawn back-to-front.

datumhue.com

(c) 2026 Shuusei AB. Quote excerpts of this manual, with attribution to DatumHue, in your own documentation, tutorials, course materials, reviews, and other writing or video. Republishing it in whole or in substantial part needs written permission: support@datumhue.com.

Victor Mono is licensed under the SIL Open Font License 1.1
Copyright (c) 2024, Rune Bjørnerås (https://github.com/rubjo)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Try

    ↑↓ selectEnter openTab filter

    Settings

    Theme
    Text
    Print

    Keyboard shortcuts

    / or Ctrl KSearch
    ↑ ↓ EnterPick a result
    TabNext result filter
    j kNext or previous entry
    [ ]Previous or next page
    yCopy a link to the current entry
    ?These shortcuts
    EscClose

    On this page