slint/examples
Montel Laurent 301892d008
Some checks failed
autofix.ci / format_fix (push) Has been cancelled
autofix.ci / lint_typecheck (push) Has been cancelled
CI / files-changed (push) Has been cancelled
CI / ffi_32bit_build (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, 1.85) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Has been cancelled
CI / build_and_test (ubuntu-22.04, 1.85) (push) Has been cancelled
CI / build_and_test (ubuntu-22.04, nightly) (push) Has been cancelled
CI / node_test (macos-14) (push) Has been cancelled
CI / node_test (ubuntu-22.04) (push) Has been cancelled
CI / node_test (windows-2022) (push) Has been cancelled
CI / python_test (macos-14) (push) Has been cancelled
CI / python_test (ubuntu-22.04) (push) Has been cancelled
CI / python_test (windows-2022) (push) Has been cancelled
CI / cpp_test_driver (macos-13) (push) Has been cancelled
CI / cpp_test_driver (ubuntu-22.04) (push) Has been cancelled
CI / cpp_test_driver (windows-2022) (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / cpp_cmake (macos-14, 1.85) (push) Has been cancelled
CI / cpp_cmake (ubuntu-22.04, stable) (push) Has been cancelled
CI / cpp_cmake (windows-2022, nightly) (push) Has been cancelled
CI / cpp_package_test (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / wasm_demo (push) Has been cancelled
CI / vsce_build_test (push) Has been cancelled
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Has been cancelled
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Has been cancelled
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Has been cancelled
CI / mcu-embassy (push) Has been cancelled
CI / tree-sitter (push) Has been cancelled
CI / updater_test (0.3.0) (push) Has been cancelled
CI / fmt_test (push) Has been cancelled
CI / esp-idf-quick (push) Has been cancelled
CI / android (push) Has been cancelled
CI / miri (push) Has been cancelled
CI / test-figma-inspector (push) Has been cancelled
Updgrade Catch2 dependency (#8846)
CMake 4.0 remove some deprecated code < 3.5 

Catch2 old version still depend against cmake 3.0 + deprecated method.
Necessary to increase version otherwise when we try to compile
example with cmake 4.0 it will failed to configure it
2025-07-05 08:54:24 +02:00
..
7guis Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
bash Use AccessibleRole::ListItem inside examples 2024-09-16 09:15:39 +02:00
bevy Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
carousel Examples/Demos: fix warning about unused padding 2025-07-04 18:35:52 +02:00
cpp [autofix.ci] apply automated fixes 2024-12-19 15:26:29 +01:00
dial dial example: Restrict angle to the defined range and refine angle calculation (#7181) 2024-12-20 19:39:28 +02:00
fancy-switches Janitor: Remove trailing whitespaces from all files 2025-01-10 13:23:22 +01:00
fancy_demo Remove stray imports of StyleMetrics 2024-07-12 09:13:35 +02:00
ffmpeg Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
gallery Menu: Add icon property 2025-06-26 18:45:37 +02:00
gstreamer-player Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
imagefilter Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
iot-dashboard Add missing include(FetchContent) 2025-04-18 15:27:37 +02:00
maps Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
mcu-board-support Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
mcu-embassy Update MSRV to 1.85 2025-06-26 22:50:15 +02:00
memory Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
opengl_texture Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
opengl_underlay Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
orbit-animation Janitor: Remove trailing whitespaces from all files 2025-01-10 13:23:22 +01:00
plotter Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
repeater Fix typos 2025-01-13 08:35:20 +01:00
slide_puzzle Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
sprite-sheet Janitor: Remove trailing whitespaces from all files 2025-01-10 13:23:22 +01:00
todo Updgrade Catch2 dependency (#8846) 2025-07-05 08:54:24 +02:00
todo-mvc Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
uefi-demo Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
virtual_keyboard Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
wgpu_texture Bump version number to 1.13.0 2025-06-26 13:30:43 +00:00
CMakeLists.txt Move printer demo and energy-monitor into new top-level demos/ folder 2024-10-25 12:09:32 +02:00
README.md Add example of rendering a Bevy scene into Slint (#8380) 2025-05-19 15:25:40 +02:00

Examples

These examples demonstrate the main features of Slint and how to use them in different language environments.

Thumbnail Description Example
Widget Gallery Gallery demo image A simple application showing the different widgets.
Project...
Wasm Demo
Energy MeterEnergy meter demo image A fictional user interface of a device that monitors energy consumption in a building.
Project...
Wasm Demo
Todo appTodo demo image A simple todo application.
Project...

A simple todo application based on the Model View Controller pattern.
Project...
Wasm Demo

Wasm MVC Demo
CarouselCarousel demo image A custom carousel widget that can be controlled by touch, mouse and keyboard.
Project...
Wasm Demo
Slide PuzzleSlide Puzzle demo image Puzzle game based on a Flutter example.
Project...
Wasm Demo
Memory GameMemory demo image A basic memory game used as an example the tutorial.
Project...
Wasm Demo
IOT Dashboardiot dashboard demo image AA clone of one demo from the QSkinny framework.
Also shows how to dynamically load widgets from C++.
Project...
Image FilterImage filter demo image A Rust-only example that shows how to use the Rust image crate to do image manipulationsand feed the result into Slint.
Project...
Wasm Demo
PlotterPlotter demo image A Rust-only example that shows how to use the Rust plotters crate to do plot a graph and integrate the result into Slint.
Project...
Wasm Demo
Using BashBash demo image Some examples of how to use the slint-viewer to add a GUI to shell scripts.
Project...
OpenGL UnderlayOpenGL Underlay demo image A Rust and C++ example that shows how render Slint on top of graphical effect rendered using custom OpenGL code.
Project...
Wasm Demo
OpenGLOpenGL Texture demo image A Rust and C++ example that shows how render a scene with custom OpenGL code into a texture and render that texture within a Slint scene.
Project...
FFmpeg ffmpeg demo image A Rust example that shows how render video frames with FFmpeg within a Slint scene.
Project...
MapsMaps demo image A rust example that load image tiles asynchronously from OpenStreetMap server and allow panning and zooming.
Project...
Virtual KeyboardVirtual Keyboard demo image A Rust and C++ example that shows how to implement a custom virtual keyboard in Slint.
Project...
7GUIs7 GUI's demo image Our implementations of the "7GUIs" Tasks.
Project...
Slint & BevyBevy demo image A demo that shows how to embed Bevy into Slint
Project...

External examples

Thumbnail Description
Cargo UICargo UI image A rust application that makes use of threads in the background.
Project...

Loading the example with the viewer

Simply load the .slint file with the viewer application

cargo run --release --bin slint-viewer -- examples/gallery/gallery.slint

Running the Rust Examples

You can run the examples either by going into folder or into the rust sub-folder and use cargo run, for example:

cd examples/gallery
cargo run --release

or you can run them from anywhere in the Cargo workspace by name:

cargo run --release --bin gallery

Wasm builds

In order to make the wasm build of the example, you first need to edit the Cargo.toml files to uncomment the line starting with #wasm# (or use the sed line bellow) You can then use wasm-pack (which you may need to obtain with cargo install wasm-pack). This will generate the wasm in the ./pkg directory, which the index.html file will open. Since wasm files cannot be served from file:// URL, you need to open a wab server to serve the content

cd examples/imagefilter/rust
sed -i "s/^#wasm# //" Cargo.toml
wasm-pack build --release --target web
python3 -m http.server

Running the C++ Examples

  • When compiling Slint from sources: If you follow the C++ build instructions, this will build the C++ examples as well by default
  • From installed binary packages: Simply run cmake in one of the example directory containing a CMakeLists.txt
mkdir build && cd build
cmake -GNinja -DCMAKE_PREFIX_PATH="<path to installed>" ..
cmake --build .

Running the Node Examples

You can run the examples by going into the node sub-folder and use pnpm, for example:

cd examples/todo/node
pnpm install
pnpm start