Editions
An edition is the Slint release whose language behavior your project uses, such as 1.19.
A project is an application or a library.
When a Slint release changes the behavior of the language, the change applies only if your edition is that release or newer. Newer versions of Slint keep compiling your project the way your edition’s release did, until you raise the edition. A library with its own project file keeps its edition in an application that uses another one. Each component follows the edition of the project it belongs to. You can use new features with any edition.
Choosing the Edition
Section titled “Choosing the Edition”Choose the major and minor version of the Slint release you write your project for, such as 1.19.
It can be the version of Slint you build with, or an older one.
The oldest edition is 1.18, with the language behavior of Slint 1.18 and earlier.
Slint refuses to compile your project if your edition is older than 1.18,
or newer than your version of Slint.
In the Project File
Section titled “In the Project File”Set edition in the project file.
Slint tools read it when you pass the project file or its directory.
Write it as a string, such as "1.19", not as the number 1.19:
{ "edition": "1.19"}In Your Build
Section titled “In Your Build”In Rust and C++, you can also set the edition where you compile your .slint files.
In Node.js and Python, set it in the project file.
An edition set there wins over the one in the project file.
The slint! macro doesn’t load a project file.
To set its edition, add an attribute at the start of the macro body; otherwise, the macro warns:
slint::slint! { #[edition = "1.19"] export component App inherits Window { }}The Slint extension for your editor and slint-viewer also read this attribute when you open the .rs file.
In build.rs, pass the edition to CompilerConfiguration::with_edition():
// build.rsfn main() { let config = slint_build::CompilerConfiguration::new().with_edition((1, 19)); slint_build::compile_with_config("ui/main.slint", config).unwrap();}With slint-interpreter, call Compiler::set_edition().
Pass EDITION to slint_target_sources:
slint_target_sources(my_application ui/main.slint EDITION 1.19)On the Command Line
Section titled “On the Command Line”To set the edition on the command line, pass --edition to slint-compiler or slint-viewer:
slint-viewer --edition 1.19 ui/main.slintWithout an Edition
Section titled “Without an Edition”Without an edition, Slint applies none of the behavior changes that depend on the edition. The compiler reports that no edition is set. To opt in, choose an edition as described above.
In SlintPad
Section titled “In SlintPad”SlintPad and the previews in this documentation use the edition of their own release.
To select another one in SlintPad ↗, add it to the URL, such as ?edition=1.18.
Links from “Share” always include the edition, so that they keep their behavior in later releases.
Behavior Changes
Section titled “Behavior Changes”Each section lists what a release changed, and how to update your code if the change breaks it.
if and for Elements Are Sized Like Other Elements
Section titled “if and for Elements Are Sized Like Other Elements”Before 1.19, wrapping an element in if true: could change the layout around it, which was a bug:
- A non-layout parent, such as a
Rectangleor aFlickable, computes its minimum and preferred size from its children. It ignored any child created withiforfor(#407 ↗). - A word-wrapped
Textwith its ownwidthin aniforforelement was measured at the layout’s width. When the layout was wider, the element came out short and the next element overlapped it (#14705 ↗).
With edition 1.19, an element created with if or for gets the same size as one written without them.
In this example, both rectangles hold the same text.
Before, the layout gave the first one a height of 0px, as if it were empty.
Now both are as tall as their text:
export component Example inherits Window { width: 200px; VerticalLayout { alignment: start; Rectangle { background: lightgray; if true: Text { text: "Quarterly Report"; } } Rectangle { background: lightblue; Text { text: "Quarterly Report"; } } }}If you wrote code for the old behavior, it might need these changes:
- A parent now grows to fit its
ifandforchildren, and an element holding wrapped text can grow by a line. This can change the size of the elements around it in a layout. Where an element should keep a size of its own, give it an explicitwidthorheight. - A child that computes its size, or another property, from that parent’s size now forms a binding loop, which the compiler reports as an error.
In this example, the title’s text depends on the width of the Rectangle,
and the Rectangle is now as wide as the text it contains:
component Header { in property <bool> show-title: true; HorizontalLayout { Rectangle { if show-title: Text { // error: The binding for the property 'text' is part of a binding loop text: parent.width > 200px ? "Quarterly Report" : "Report"; } } Rectangle { background: lightblue; } }}To fix the loop, size the child, or compute its properties, without reading the parent’s size:
-
Give the parent an explicit
widthorheight:component Header {in property <bool> show-title: true;HorizontalLayout {Rectangle {width: 150px;if show-title: Text {text: parent.width > 200px ? "Quarterly Report" : "Report";}}Rectangle { background: lightblue; }}}slint -
Replace
width: parent.widthwithwidth: 100%, and the same forheight. Don’t do this for an element placed in a layout: there, a percentage sets an exact size in the layout. -
When a layout already applies the padding and spacing, remove any size computed from the parent’s size minus that padding.
-
As a last resort, set
xoryon the child, which keeps it out of its parent’s size. This pins its position: aTextthat was centered in its parent moves to0, 0. In a layout, where settingxis an error, wrap the child in aRectangleand setxon that.
Properties Set Only by States Keep Their Default Value
Section titled “Properties Set Only by States Keep Their Default Value”Before 1.19, a width, height, x, or y that only some states set was 0px while none of them applied.
It didn’t keep the element’s default size and position.
Adding a state for one case changed every other case too, which was a bug
(#8852 ↗).
With edition 1.19, the property keeps its default while none of the states applies.
In this example, the Rectangle now covers the window unless compact is true.
Before, it disappeared whenever compact was false:
export component Example inherits Window { width: 200px; height: 100px; in property <bool> compact; Rectangle { background: blue; states [ small when compact: { height: 20px; } ] }}If your code relied on the 0px, set the value outside the states, such as height: 0px;.
If a parent follows the size that the states set, the two now form a binding loop,
because the element’s default size follows the parent.
The compiler reports it even when one state always applies, because it can’t prove the conditions cover every case:
export component Example inherits Window { in property <bool> open; VerticalLayout { Rectangle { // error: The binding for the property 'height' is part of a binding loop height: panel.height; panel := VerticalLayout { states [ expanded when open: { height: self.preferred-height; } collapsed when !open: { height: 0px; } ] animate height { duration: 100ms; } Text { text: "Details"; } } } }}To fix the loop, add height: 0px; to panel, or replace its states with height: open ? self.preferred-height : 0px;.
Binding Loops Inside a Longer Binding Loop Are Reported
Section titled “Binding Loops Inside a Longer Binding Loop Are Reported”Before 1.19, the compiler skipped a binding loop when all its bindings were part of a longer binding loop it had already reported:
- When the longer loop went through the window layout, it was only a warning, so the code compiled.
- When the longer loop was an error too, the shorter one only showed up after fixing the longer one.
With edition 1.19, the compiler reports the shorter loop as an error too.
In this example, the inner Rectangle is a cell of the VerticalLayout and also reads its width.
Before, the compiler only warned about the loop through the window layout:
export component Example inherits Window { HorizontalLayout { Rectangle { VerticalLayout { // error: The binding for the property 'width' is part of a binding loop Rectangle { width: parent.width; } } } }}To fix the loop, remove width: parent.width;: a layout already stretches its cells to its width.
© 2026 SixtyFPS GmbH