Live Preview in Your Application
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.
A Node.js application compiles them when it loads them, so every UI change requires restarting it.
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.
It’s the same live preview as the one in VS Code,
the Slint LSP, and the Slint Viewer.
The same interpreter loads and renders your .slint files, so the UI looks and behaves the same.
What differs is the surroundings:
here the preview runs inside your application, wired up to your business logic.
How It Works
Section titled “How It Works”When live preview is enabled,
the Slint interpreter loads your components at runtime, instead of the code compiled ahead of time in Rust and C++.
It reloads .slint files from disk whenever they change.
The application keeps running during reloads,
and the properties, callbacks, and models that your code set 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 your code interacts with, for example by renaming a property or callback it uses, the application may stop working. 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.
Live preview for Node.js requires the slint-ui-dev package and the SLINT_LIVE_PREVIEW environment variable.
-
Install
slint-ui-devas a dev dependency, at the same version asslint-ui:Terminal window npm install --save-dev slint-ui-devbash -
Run your application with the
SLINT_LIVE_PREVIEWenvironment variable set:Terminal window SLINT_LIVE_PREVIEW=1 node main.jsbashSlint reloads the
.slintfiles that you import or load withloadFile()whenever you save changes.
© 2026 SixtyFPS GmbH