Slint Viewer
The slint-viewer command-line tool opens and previews .slint files.
Use it to iterate on a UI with live reload, render screenshots, or check that a file compiles.
Installation
Section titled “Installation”Install the binary from crates.io with a Rust toolchain:
cargo install slint-viewerAlternatively, download a pre-built binary for Linux or Windows:
- Go to the latest Slint release ↗.
- From “Assets” download
slint-viewer-linux.tar.gzfor Linux orslint-viewer-windows-x86_64.zipfor Windows. - Uncompress the archive and run
slint-viewer.
On Debian-like systems, install the runtime dependencies with:
sudo apt install -y libx11-xcb1 libxcb1 libxkbcommon0 libinput10 libgbm1Opening a File
Section titled “Opening a File”Pass a path to preview a .slint file:
slint-viewer path/to/myfile.slintUse - instead of a path to read from standard input.
Add --auto-reload to watch the file on disk and reload the preview whenever it changes, so you can iterate without restarting the viewer:
slint-viewer --auto-reload path/to/myfile.slintRendering a Screenshot
Section titled “Rendering a Screenshot”--screenshot renders the component to an image and exits, with no window:
slint-viewer --screenshot screenshot.png path/to/myfile.slintThe image format follows the file extension (such as .png or .jpg).
Use - to write a PNG to standard output.
Set the SLINT_SCALE_FACTOR environment variable to override the default scale factor of 1.
Checking a File
Section titled “Checking a File”--check compiles the file, prints any diagnostics, and exits without opening a window.
The exit status is 1 on error and 0 otherwise; warnings still print.
slint-viewer --check path/to/myfile.slintLoading and Saving Property Data
Section titled “Loading and Saving Property Data”--save-data writes the component’s public properties to a JSON file when the viewer exits:
slint-viewer --save-data output.json path/to/myfile.slint--load-data sets them from a JSON file at startup:
slint-viewer --load-data input.json path/to/myfile.slintEach works on its own; pass both to load initial values and write the result back. Only properties whose types serialize to JSON are read or written, and --save-data is incompatible with --auto-reload.
For a component with these properties:
export component Form inherits Window { in-out property <string> name; in-out property <int> age;}the JSON file looks like:
{ "name": "Alice", "age": 30}Remote Viewer
Section titled “Remote Viewer”--remote starts the viewer in remote mode.
Instead of loading a file, the viewer waits for the live preview in your editor to connect over the network and push the UI to it.
Use it to preview a .slint file on another machine or a device while you edit on your computer.
slint-viewer --remoteThe viewer shows an idle screen with its name and the address to connect to, and advertises itself on the local network so editors can discover it.
By default it listens on an automatically assigned port on all network interfaces.
Pass --remote-address <address> to choose a specific address and port.
To connect, open the live preview of a .slint file in your editor, then pick Remote from the combobox in the top-right corner of the preview and enter the address the viewer shows.
The editor compiles the .slint file and sends the result to the remote viewer, reloading it as you edit, while debug output from the previewed UI is sent back to the editor.
--remote doesn’t take a file path, and can’t be combined with --screenshot or --check.
Command-Line Options
Section titled “Command-Line Options”Run slint-viewer --help for the authoritative, always-current list. The common options:
| Option | Description |
|---|---|
<path> | The .slint file to load. Required unless --remote is given. |
--auto-reload | Watch the file system and reload when the file changes. |
--load-data <file> | Load the values of public properties from a JSON file. |
--save-data <file> | On exit, write the values of public properties to a JSON file. Incompatible with --auto-reload. |
--screenshot <file> | Render the component to an image and exit. |
--check | Compile the file, print diagnostics, and exit without opening a window. Incompatible with the options above. |
--remote | Start in remote mode and wait for the editor to connect. See Remote Viewer. |
--remote-address <address> | Address and port to listen on in remote mode. Defaults to an auto-assigned port on all interfaces. |
--component <name> | Load the component with this name. Defaults to the last exported component. |
--style <style> | Set the widget style. Defaults to fluent. |
--backend <backend> | Override the Slint rendering backend. |
-I <path> | Add an include path for imported .slint files or images. |
-L <library=path> | Add a library path for @library imports. |
--on <callback> <handler> | Run a shell command when a callback is invoked. See Callback Handlers. |
Use - in place of a file path to read from standard input or write to standard output.
A viewer built with the gettext feature also accepts --translation-domain <domain>, --translation-dir <dir>, and --no-default-translation-context to resolve @tr(...) strings against gettext catalogs.
Callback Handlers
Section titled “Callback Handlers”--on runs a shell command when a callback is invoked, followed by the callback name and the command.
In the command, $1, $2, … are replaced by the callback arguments, shell-escaped.
Given a .slint file with an open-url callback:
export component MyApp inherits Window { callback open-url(string); // ...}Wire the callback to a command:
slint-viewer --on open-url 'xdg-open $1' myfile.slintUse single quotes, or escape the $, so the shell does not expand $1.
Dialogs
Section titled “Dialogs”When the root element is a Dialog, the standard buttons close it if no callback is set on the button:
ok,yes, andcloseaccept the dialog.cancelandnoreject the dialog.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | A window was closed, or a dialog was accepted with Ok, Close, or Yes. |
1 | A dialog was rejected with Cancel, No, or the window’s close button. Also a compilation error under --check or --screenshot. |
2 | Command-line argument parsing or validation failed. |
-1 | Compilation failed (except under --check or --screenshot). |
Driving a UI From a Shell Script
Section titled “Driving a UI From a Shell Script”slint-viewer can display a GUI from a shell script.
Read .slint from standard input with -, and write the property values back as JSON on exit with --save-data -, so a script can collect user input from a dialog.
For a walkthrough, see the blog post Showing GUIs from shell scripts ↗. Ready-to-run examples live in the examples/bash ↗ folder.
© 2026 SixtyFPS GmbH