Skip to content

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.

Install the binary from crates.io with a Rust toolchain:

Terminal window
cargo install slint-viewer
bash

Alternatively, download a pre-built binary for Linux or Windows:

  1. Go to the latest Slint release.
  2. From “Assets” download slint-viewer-linux.tar.gz for Linux or slint-viewer-windows-x86_64.zip for Windows.
  3. Uncompress the archive and run slint-viewer.

On Debian-like systems, install the runtime dependencies with:

Terminal window
sudo apt install -y libx11-xcb1 libxcb1 libxkbcommon0 libinput10 libgbm1
bash

Pass a path to preview a .slint file:

Terminal window
slint-viewer path/to/myfile.slint
bash

Use - 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:

Terminal window
slint-viewer --auto-reload path/to/myfile.slint
bash

--screenshot renders the component to an image and exits, with no window:

Terminal window
slint-viewer --screenshot screenshot.png path/to/myfile.slint
bash

The 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.

--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.

Terminal window
slint-viewer --check path/to/myfile.slint
bash

--save-data writes the component’s public properties to a JSON file when the viewer exits:

Terminal window
slint-viewer --save-data output.json path/to/myfile.slint
bash

--load-data sets them from a JSON file at startup:

Terminal window
slint-viewer --load-data input.json path/to/myfile.slint
bash

Each 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;
}
slint

the JSON file looks like:

{
"name": "Alice",
"age": 30
}
json

--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.

Terminal window
slint-viewer --remote
bash

The 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.

Run slint-viewer --help for the authoritative, always-current list. The common options:

OptionDescription
<path>The .slint file to load. Required unless --remote is given.
--auto-reloadWatch 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.
--checkCompile the file, print diagnostics, and exit without opening a window. Incompatible with the options above.
--remoteStart 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.

--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);
// ...
}
slint

Wire the callback to a command:

Terminal window
slint-viewer --on open-url 'xdg-open $1' myfile.slint
bash

Use single quotes, or escape the $, so the shell does not expand $1.

When the root element is a Dialog, the standard buttons close it if no callback is set on the button:

  • ok, yes, and close accept the dialog.
  • cancel and no reject the dialog.
CodeMeaning
0A window was closed, or a dialog was accepted with Ok, Close, or Yes.
1A dialog was rejected with Cancel, No, or the window’s close button. Also a compilation error under --check or --screenshot.
2Command-line argument parsing or validation failed.
-1Compilation failed (except under --check or --screenshot).

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