Skip to content

Controls reference

The designer offers 23 controls. Every property on this page can be changed in the Properties panel (or by writing an expression with fx), and every event is connected with Events → Create: the function is added to main.rs (see Connecting to Rust).

Every property and event on this page is checked with the Slint 1.19 compiler on every change to the designer.

Property In the panel Value Default
title Title text —
width Width length (px) —
height Height length (px) —
icon Icon image —
background Background color —
default-font-size Default font size length (px) —
default-font-family Default font text —
default-font-weight Default weight option: 100, 200, 300, 400, 500, 600, 700, 800, 900 400
always-on-top Always on top yes / no false
no-frame Frameless (no title bar) yes / no false

Inside a column, row or grid, the layout decides the position. Instead of X and Y you get:

Property In the panel Value Default
width Fixed width length (px) —
height Fixed height length (px) —
horizontal-stretch Grow horizontally number —
vertical-stretch Grow vertically number —
min-width Minimum width length (px) —
max-width Maximum width length (px) —
min-height Minimum height length (px) —
max-height Maximum height length (px) —

Slint doesn’t allow a fixed width together with a minimum or maximum width (nor the same for height): setting one makes the designer remove the other.

And inside a grid, also:

Property In the panel Value Default
row Row integer 0
col Column integer 0
colspan Columns it spans integer 1
rowspan Rows it spans integer 1
Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
text Text text (multiple lines) —
font-size Font size length (px) 14px
font-weight Weight option: 100, 200, 300, 400, 500, 600, 700, 800, 900 400
font-family Font text —
font-italic Italic yes / no false
letter-spacing Letter spacing length (px) 0px
color Color color —
horizontal-alignment Horizontal alignment option: left, center, right left
vertical-alignment Vertical alignment option: top, center, bottom top
wrap Word wrap option: no-wrap, word-wrap, char-wrap no-wrap
overflow If it doesn’t fit option: clip, elide clip
stroke Outline: color color —
stroke-width Outline: width length (px) 0px
opacity Opacity 0 to 1 1
visible Visible yes / no true

Use from Rust: text (SharedString).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
text Text text —
icon Icon image —
primary Primary (accent color) yes / no false
colorize-icon Color the icon like the text yes / no false
opacity Opacity 0 to 1 1
checkable Can stay pressed yes / no false
checked Pressed (if it can stay pressed) yes / no false
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
clicked On click —

Use from Rust: text (SharedString), enabled (bool), checked (bool).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
text Text text —
placeholder-text Placeholder text text —
input-type Input type option: text, password, number, decimal text
read-only Read only yes / no false
font-size Font size length (px) —
horizontal-alignment Text alignment option: left, center, right left
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
accepted On Enter text (SharedString)
edited On text change text (SharedString)

Use from Rust: text (SharedString).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
text Text text (multiple lines) —
placeholder-text Placeholder text text —
wrap Word wrap option: word-wrap, no-wrap word-wrap
read-only Read only yes / no false
font-size Font size length (px) —
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
edited On text change text (SharedString)

Use from Rust: text (SharedString).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
text Text text —
checked Checked yes / no false
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
toggled On check or uncheck —

Use from Rust: checked (bool).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
text Text text —
checked On yes / no false
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
toggled On turn on or off —

Use from Rust: checked (bool).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
value Value number —
minimum Minimum number 0
maximum Maximum number 100
step Step number 1
orientation Orientation option: horizontal, vertical horizontal
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
changed On move value (f32)
released On release value (f32)

Use from Rust: value (f32).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
value Value integer —
minimum Minimum integer 0
maximum Maximum integer 100
step-size Step (arrows) integer 1
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
edited On value change value (i32)

Use from Rust: value (i32).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
model Options list of texts —
current-index Selected index integer 0
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
selected On option chosen value (SharedString)

Use from Rust: current-index (i32), current-value (SharedString).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
progress Progress 0 to 1 —
indeterminate Indeterminate (animated) yes / no false
opacity Opacity 0 to 1 1
visible Visible yes / no true

Use from Rust: progress (f32).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
source File image —
image-fit Fit option: fill, contain, cover, preserve fill
colorize Colorize (icons) color —
image-rendering Scaling option: smooth, pixelated smooth
opacity Opacity 0 to 1 1
visible Visible yes / no true
Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
indeterminate Spinning continuously yes / no false
progress Progress 0 to 1 —
opacity Opacity 0 to 1 1
visible Visible yes / no true

Use from Rust: progress (f32).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
kind Type option: ok, cancel, apply, close, reset, help, yes, no, abort, retry, ignore ok
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
clicked On click —

Use from Rust: enabled (bool).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
model Items list items —
current-item Elemento seleccionado (-1 = ninguno) integer -1
opacity Opacity 0 to 1 1
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
current-item-changed On selection change index (i32)

Use from Rust: current-item (i32).

Container: the controls inside it are placed at fixed positions (X, Y).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
background Background color —
border-radius Corner radius length (px) 0px
border-width Border width length (px) 0px
border-color Border color color —
drop-shadow-color Shadow: color color —
drop-shadow-blur Shadow: blur length (px) 0px
drop-shadow-offset-x Shadow: X offset length (px) 0px
drop-shadow-offset-y Shadow: Y offset length (px) 0px
opacity Opacity 0 to 1 1
clip Clip the content yes / no false
visible Visible yes / no true

Automatic layout: it arranges the controls inside it by itself.

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
padding Padding length (px) 8px
spacing Spacing length (px) 8px
alignment Distribution option: stretch, start, center, end, space-between, space-around, space-evenly stretch
visible Visible yes / no true

Automatic layout: it arranges the controls inside it by itself.

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
padding Padding length (px) 8px
spacing Spacing length (px) 8px
alignment Distribution option: stretch, start, center, end, space-between, space-around, space-evenly stretch
visible Visible yes / no true

Automatic layout: it arranges the controls inside it by itself.

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
padding Padding length (px) 8px
spacing Spacing length (px) 8px
visible Visible yes / no true
Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
title Title text —
content-padding Content padding length (px) 0px
enabled Enabled yes / no true
visible Visible yes / no true
Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
current-index Initial tab (0 = first) integer 0
visible Visible yes / no true

Use from Rust: current-index (i32).

Container: the controls inside it are placed at fixed positions (X, Y).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
content-width Content width length (px) —
content-height Content height length (px) —
visible Visible yes / no true
Event In the panel Receives
scrolled On scroll —

Container: the controls inside it are placed at fixed positions (X, Y).

Property In the panel Value Default
x X length (px) —
y Y length (px) —
width Width length (px) —
height Height length (px) —
mouse-cursor Cursor option: default, pointer, text, move, crosshair, grab, grabbing, help, wait, progress, not-allowed, copy, ew-resize, ns-resize default
enabled Enabled yes / no true
visible Visible yes / no true
Event In the panel Receives
clicked On click —
double-clicked On double-click —
moved On mouse move with the button pressed —

It isn’t visible in the window: the designer shows it in the Components tray, below the canvas.

Property In the panel Value Default
interval Interval duration (ms) 0ms
running Running yes / no true
Event In the panel Receives
triggered When the interval elapses —

Use from Rust: running (bool).