Skip to main content

Buttons and values

All of these are focus stops. OK (Enter, Space) activates on release; value controls take Left/Right.

Button​

Button { text: @tr("x.save"); kind: ButtonKind.filled; clicked => { … } }
Property
text, iconlabel and optional leading icon
kindfilled (main action), tonal, text (quiet), danger
clicked()

IconButton​

A round icon button. icon, color, filled (accent circle), size (default 48 px), label (for screen readers, required), flush (no padding, aligns with an edge); clicked().

Switch​

checked; toggled(bool). Inside a ListRow use trailing: switch instead: the whole row is the target.

Slider​

value (0–1), minimum, icon, label. moved(float) while dragging or on each key press; released() at the end (save then). Left/Right step by 5 %.

StepSlider​

A slider with steps (text size, timeouts): steps (labels), step (index), label. preview(int) while moving, changed(int) at the end.

Segmented​

A row of choices: options: [string], selected: int, label; changed(int). One focus stop; Left/Right change the choice.

TimeStepper​

Minutes with − and + : minutes, step, label; changed(int).

TextField​

TextField {
placeholder: @tr("x.name");
text <=> Backend.name;
accepted => { … } // Enter
}
Property
text, placeholder
passwordhides the text, with a reveal button
multiline
input-typeSlint's InputType (e.g. number): picks the keyboard layout
accepted(), edited(text)
grab-focus()start editing (a popup with one field calls it in init)

With keys, a text field is first selected (a ring); OK or typing starts editing, Back stops it. When the on-screen keyboard comes up, the field moves above it by itself.

Tappable​

Makes anything a target that works by touch and keys. Use it instead of a TouchArea.

Property
labelaccessible name (required)
radiusfor the focus ring and pressed overlay
innerdraw the ring inside (when the element touches a clipping edge)
liftscale on TV focus
pressed (out), inverse (out)to draw your own pressed/focused state
clicked()