The language

Files

Events can also run inline scripts. File-level scriptLanguage: "lua" selects Lua; JavaScript is the default when omitted. See Inline scripts.

A file may contain any number of these definitions in any order:

Top level
Dialog Name { ... } A dialog with its own size (size); the application opens its frame
Screen Name { ... } The contents of a page; the application supplies the page and its geometry
component Name : Basistyp { ... } A reusable element
record Name { typ feld ... } An application data type, for example a list row

Elements

qml
Typ [id] {
    property: wert
    Kind { ... }
}
Type aura-ui Type-specific properties
Item Node –
Rect RectNode color, radius, corners: topLeft, topRight, bottomRight, bottomLeft, border: width, color, gradient: top, bottom
Text TextNode text, font: family, size[, weight], weight, color, align: left|center|right[, top|center|bottom], wrap: width[, alignment], fit: true|minimumSize, lineHeight (QML factor), letterSpacing (px), pixelSize/minimumPixelSize (px, bypassing Context::fontSize), underline
Image ImageNode source: "name.png" (Context::image) or image: value (an application image of type image), fill: stretch|crop|fit|pad, radius, corners
Svg SvgNode source: "name.svg", fill: color
Scroll ScrollNode contentHeight, contentY; horizontal with direction: horizontal: contentWidth, contentX. When a horizontal scroll is nested inside a vertical one, the direction of the finger decides which scrolls
QrCode QrCodeNode text (contents), color
Html HtmlNode text (HTML like QML RichText), font: family, size, color, lineHeight, margin (documentMargin); without height, its height follows the text at its given width
Column ColumnNode spacing, padding, align: left|center|right, justify; stacks visible children from the top and grows to their combined height (see Layouts)
Row RowNode spacing, padding, align: top|center|bottom, justify, wrap: true, direction: leftToRight|rightToLeft; arranges visible children from the left and grows to their combined width, or arranges them from its right edge
Grid GridNode columns, spacing, padding, cell: width, height; cells take the size of the first visible child (or cell); height follows the rows
Popover PopoverNode color, markerPos, unfold (visible fraction of the height, 0–1; enter: unfold 0 300 linear unfolds it); a speech bubble with a marker at the top
Ripple RippleNode color (gray), opacity (0.4), size (200 × 200); feedback for its parent: appears under the finger when pressed and pulses (1 ↔ 1.1, 500 ms each way), grows to four times its size over 500 ms after a tap, then runs the parent's onTap (immediately without an animator). Place it last to draw it on top; the parent clips its children (clip)
TextField TextFieldNode (aura/ui/text_input.h) text (initial value, see Text input), font, weight, color, align, letterSpacing, pixelSize, placeholder, placeholderColor (#cccccc), masked (* per character), maxLength (characters), characters (allowed characters, e.g. "0123456789*#"), focus: true, onChange: signal, onAccept: signal; a single line with a caret, clips and scrolls to keep the caret visible
Keyboard KeyboardNode (aura/ui/text_input.h) layout: "DE" (CZ, DE, DK, EN, FI, FR, NL, NO, PL, SE, SI, SK, also lowercase; "alphanum": 800 × 240, digits and uppercase letters, Backspace, OK, Cancel), color, radius, border, keyColor, textColor, accentColor (modifier keys), okColor, cancelColor, cancelText, okKey: false, onOk: signal, onCancel: signal; an on-screen keyboard, 960 × 300, scaled to its own size
Button ButtonNode (aura/ui/controls.h) text, font, weight, textColor (white), color (#404040), pressedColor (otherwise a darker color), radius (8), border; a button with centered text, default size 200 × 60 (see Controls)
CheckBox CheckBoxNode text, font, textColor, color (box), radius, checked, onToggle: signal; tapping toggles it
Switch SwitchNode Like CheckBox, plus trackColor (off); a sliding switch, color (on)
RadioButton RadioButtonNode Like CheckBox, plus group; tapping selects it and clears the others in the same group (without group: its siblings). Only the newly selected button emits onToggle
ComboBox ComboBoxNode options (list of strings), index (-1: none), placeholder, font, textColor, color, radius, border, listColor, listTextColor, selectedColor, visibleRows (6), onSelect: signal; tapping opens a list below it, above the entire scene (or above the control if there is no room below); tapping outside closes it
Slider SliderNode value, from (0), to (1), step, color, trackColor, onChange: signal; drag or tap the track
ProgressBar ProgressBarNode value, from (0), to (1), color, trackColor, radius (half its height)
Rive RiveNode source: "goodbye.riv" (Context::file); loops the default state machine of the default artboard (otherwise its first animation) through the animator, fitted like PreserveAspectFit
WebView aura::webview::WebViewNode (libaura-webview) url, script (JavaScript, run in each page before its own scripts); Chromium through CEF, touch input, WebChannel to C++ (aura.call, aura.on). Only in applications with AURA_WITH_WEBVIEW; see aura-webview.md

Application element types: An aura-elements.json beside or above the .aura files that use them describes elements drawn by the application:

The following example describes an application-provided BadgeNode, not a built-in AURA element.

json
{
	"Badge": {
		"type": "BadgeNode",
		"header": "widgets/badge_node.h",
		"properties": {
			"color": {"type": "color"},
			"label": {"type": "string", "set": "setLabel()"}
		}
	}
}

All elements also have:

Property Meaning
name objectName (remote control, logs); defaults to the ID
x, y, width, height, size: w, h Geometry
place: ... Anchors; see below
visible, opacity, rotation, scale, clip, glow As in aura-ui (clip clips to a rectangle, like Qt Quick; glow glows white, e.g. glow: root.pressed)
onTap: signal, onTap: signal(args), onTap: ignore Emits a signal or consumes the tap
enabled: false Disables input for the element and its children (QML enabled); controls dim themselves
grow: weight In a Column/Row: a share of the free space along the layout direction (QML Layout.fillHeight/fillWidth)
stretch: true In a Column/Row: fills across the layout direction (width or height); fills its cell in a Grid
minWidth, maxWidth, minHeight, maxHeight Limits for grow and stretch (0: none)
onSettled: signal An element animation (animate:) reached its target; see Animations
pressSink: offset, ms Sinks when pressed
spin: ms Spins clockwise indefinitely, one revolution per ms (service menu gear)
loop: property from to ms [easing] [pause ms], … Oscillates indefinitely between two values; see Animations

Text in detail:

Anchors (place)

place: left 44, below title 30, centerY -20 becomes aura::ui::place(node).left(44).below(*title, 30).centerY(-20) (see graphics.md). Order matters.

Directive Meaning
left, right, top, bottom [gap] Relative to the parent's edge
centerX, centerY [offset], center Centered in the parent, rounded
below, above, rightOf, leftOf element [gap] Beside an element
alignLeft, alignTop, alignBottom element [offset] Aligned to an element
centerXOn, centerYOn element Relative to an element's center

Valid elements are IDs defined earlier in the source (siblings or ancestors), parent, and id[index] for repeated elements, e.g. centerYOn field[0].

Layouts: Column, Row, Grid

Layouts arrange their visible children when a child is added. If a child changes later (through a binding or rebuilding), they rearrange. Their own size follows the content (Column: height; left-to-right Row: width; Grid: height), so other elements can refer to it:

qml
Scroll list {
    size: parent.width - 4, min(len(lines), 5) * 76
    contentHeight: productRows.height   // nach dem Bau der Zeilen
    Column productRows {
        width: parent.width
        repeat line, i in lines { CartRow { index: i; line: line } }
    }
}
// Header: rechtsbündig
Row buttons { direction: rightToLeft; spacing: 16; size: parent.width, 60 }
// Grid layout
Grid cells { columns: columns; spacing: 10 }

Invisible children take no space. Children set their own size; the layout assigns their position along its direction (Column: y; Row: x; Grid: both).

Flexible: These properties let a layout distribute space instead of just stacking:

qml
Column {
    size: 400, parent.height
    padding: 20                     // 1 Wert, 2 (oben/unten, links/rechts) oder 4 (oben, rechts, unten, links)
    spacing: 10
    align: center                   // quer: left, center, right (Row: top, center, bottom)

    Text { text: tr("Title", "Titel") }
    Scroll { grow: 1 }              // nimmt die restliche Höhe
    Row {
        stretch: true               // so breit wie die Column (ohne padding)
        height: 60
        justify: spaceBetween       // start, center, end, spaceBetween, spaceAround, spaceEvenly
        DialogButton { text: "Zurück" }
        DialogButton { text: "Weiter"; grow: 1; maxWidth: 300 }
    }
}
Row tags { width: 500; wrap: true; spacing: 8 }    // bricht in Zeilen um (QML Flow), wird so hoch wie sie

Expressions

Values Numbers (internally double, as in QML), "Text" (with \n, \t, \b), colors #rrggbb/#aarrggbb, true/false, lists [a, b]
Operators + - * / %, == != < > <= >=, && || !, a ? b : c; + also concatenates strings
Names IDs (defined earlier), parent, own geometry (x, y, width, height, implicitWidth, implicitHeight), loop variables, dialog or component property declarations (also as root.<name>)
Element values id.x, .y, .width, .height, .opacity, .rotation, .scale, .pressed, .implicitWidth/.implicitHeight (Text; Image: image size; Html: height), .contentHeight (Scroll)
Records zeile.feld, liste[i].feld, root.zeile.feld
Lists liste[i], len(liste), e.g. ["", "ABC", "DEF"][i]
Context theme.<name>, screen.width, screen.height, props.bool("ID"), props.int("ID"), props.string("ID")
Functions tr("id", "Deutsch"), str(zahl), replace(text, alt, neu), lower(text), upper(text), len(liste|text), fontSize(px) (Context::fontSize), ceil, floor, round, abs, min, max, range(n)

Types are checked: a string where a number is required, or a field absent from a record, causes the build to fail.

Repetition and conditions

qml
repeat key, index in ["1", "2", "\b"] {
    Item keyItem { x: index % 3 * 94; onTap: keyPressed(key) }
}
repeat i in range(6) { Rect field { x: digitsX + i * 54 } }
repeat line, i in lines { CartRow row { line: line } }

if key == "\b" { Svg { ... } } else { Text { ... } }

Property order

Each element follows this order, just like the earlier handwritten code:

  1. Content (text, colors, font, …),
  2. natural text size,
  3. geometry (x, y, width, height, size, place, contentHeight) in source order.

This is why height: back.y - 30 - y works after place: left 44, below editBox 30.

References to own children: A property referring to an ID in its own subtree is applied only once that child is built, immediately afterwards. Later children already see the value:

qml
component PriceRow : Rect {
    height: topicText.height + 12       // nach topicText
    Text topicText { wrap: 290 }
    Text { place: right 15, centerY }   // sieht die Zeilenhöhe
}

Pressed state

A property referring to id.pressed is reevaluated whenever that state changes. All descendants of id are reevaluated too, so anchors follow:

qml
Item keyItem {
    onTap: keyPressed(key)
    Rect face {
        x: keyItem.pressed ? 5 : 0
        width: parent.width - (keyItem.pressed ? 8 : 0)
        Text { size: parent.width, parent.height }   // folgt dem Rect
    }
}

id itself is not rearranged, since that would reset a pressSink, for example. Components can also use root.pressed (key, footer button).

Text input

qml
TextField code {
    font: theme.textFont, 48
    placeholder: tr("Voucher_Code", "Gutscheincode")
    maxLength: 20
    focus: true
    size: 400, 60
    onChange: codeChanged           // signal codeChanged(string text)
    onAccept: redeem                // Enter
}
Rect ok { onTap: redeem(code.text) }
Keyboard {
    layout: props.string("CurrentLanguage")          // "de", "EN", ...; unbekannt: DE
    place: centerX, bottom 20
    onOk: redeem(code.text)
    onCancel: close
}

Controls

qml
Column {
    padding: 24
    spacing: 16
    CheckBox agb { text: tr("Agb", "AGB gelesen"); checked: accepted; onToggle: accept }    // signal accept(bool on)
    Slider { from: 0; to: 100; step: 5; value: volume; onChange: setVolume }                // signal setVolume(real v)
    ProgressBar { value: uploaded; to: total; stretch: true }
    Button { text: tr("Next", "Weiter"); color: theme.mainColor; enabled: agb.checked; onTap: next }
}

Dialog and screen

qml
Dialog OrderStatusDialog {
    property strings digits             // Argument der App (Zustand)
    const real digitsX: 140          // Konstante
    signal keyPressed(string key)
    size: 860, 600
    ...
}

Property types: real, int, bool, string, color, image (an application image, sk_sp<SkImage> in C++; may be empty), strings (a list of strings, std::vector<std::string> in C++), a record and Datensatz[] (a list).

Components

qml
component DialogButton : Rect {
    property string text        // Argument der Instanz (": wert": Standard)
    color: theme.mainColor
    radius: 4
    pressSink: 4, 250
    Text {
        text: root.text
        fit: true
        align: center, center
        size: parent.width, parent.height
    }
}

component LanguageButton : Rect {
    property string language
    signal select                       // eigenes Signal der Komponente
    onTap: select
    ...
}
Documentation source: docs/aura.md · Download Markdown

Search for topics, widgets or APIs.