Live Preview for Rust and C++
When building a Slint application in Rust or C++,
.slint files are normally compiled ahead of time into native code.
This means every UI change requires recompiling and restarting the application.
The live preview feature lets your running application watch .slint files on disk
and reload them automatically when they change.
Your business logic stays connected, so you can iterate on the UI without restarting.
How It Works
Section titled “How It Works”When live preview is enabled,
Slint replaces the ahead-of-time compiled UI with an interpreter-based component
that reloads .slint files from disk whenever they change.
The application keeps running during reloads —
properties, callbacks, and models are preserved.
If a .slint file has a syntax error, the previous version stays on screen until the error is fixed.
If you change the Slint API that the native code interacts with, for example renaming a property or callback used from Rust or C++, the application may terminate. Recompile and restart to pick up those changes.
This feature is intended for development only. Don’t ship release builds with live preview enabled.
Live preview requires the live-preview Cargo feature and the SLINT_LIVE_PREVIEW environment variable.
Build your application with both:
SLINT_LIVE_PREVIEW=1 cargo run --features slint/live-previewDon’t add live-preview to the [features] section of your Cargo.toml.
Use the --features flag on the command line instead,
so it stays out of your regular builds.
See the live-preview feature documentation for more details.
Live preview for C++ requires building Slint from source with the interpreter enabled.
-
Build Slint from source with the
SLINT_FEATURE_LIVE_PREVIEWCMake option enabled:Terminal window mkdir build && cd buildcmake -GNinja -DSLINT_FEATURE_LIVE_PREVIEW=ON path/to/slintcmake --build .bash -
Compile your application with the
SLINT_LIVE_PREVIEWenvironment variable set:Terminal window SLINT_LIVE_PREVIEW=1 cmake --build path/to/your/buildbash -
Run your application. Slint loads
.slintfiles from disk and reloads them whenever you save changes.
See the C++ live preview documentation for more details.
© 2026 SixtyFPS GmbH