Actively developed · Breaking changes are still expected.

Slint Kit Documentation

Search the documentation

    ↑ ↓ to browse · Enter to open · Escape to close

    Compose a workspace application

    The workspace example assembles account settings, a project list and an edit dialog using public Slint Kit components. The composition uses the built-in Tailwind presentation in light and dark modes. The Rust host owns the project data, filtering and in-memory updates.

    Try the complete composition

    The demo controls switch theme, light/dark presentation and text scale. Compare the same data and layout, including a local customization, rather than maintaining a second set of components. Changes in the demo are held in memory.

    Run it in a native application

    Download workspace.slint as ui/app.slint and workspace.rs as src/main.rs. Add these two files to the same project:

    Cargo.toml

    [package]
    name = "workspace-example"
    version = "0.1.0"
    edition = "2024"
    
    [dependencies]
    slint-kit = "=0.9.0"
    slint = { version = "=1.19.0", default-features = false, features = ["std", "compat-1-18", "backend-winit", "renderer-skia", "accessibility"] }
    
    [build-dependencies]
    slint-kit-build = "=0.9.0"
    

    build.rs

    fn main() {
        slint_kit_build::compile("ui/app.slint").expect("compile workspace");
    }
    

    Run cargo run from the project directory. The source includes the main entry point, form-validation initialization, a model keyed by project identity, filtering and save callbacks. The application uses the built-in Tailwind presentation with Inter.

    Choose KitThemes.light or .dark to switch modes. The source imports { InterFont } from @kit-fonts/inter.slint and selects it with default-font-family: InterFont.family. Theme setup and local styling.

    Keep application ownership clear

    ProductWorkspace.projects is a controlled projection supplied by the host. Search and filter requests return to Rust; project identity stays independent of row order. Save callbacks validate before applying changes and acknowledge completion. Replace the in-memory store with your own application services while preserving those ownership boundaries.

    The composite passes its theme to its children and dialog explicitly. A component’s local radius, padding or icon does not change neighboring regions. The dialog disables background controls while open, preserves the opener and returns focus after dismissal or completion.

    When adapting the example, keep the native editors, keyboard handling, field constraints and named actions. Test the real target backend with long labels and enlarged text; the browser demo does not qualify platform IME or screen readers.

    The example imports ListView directly from @kit. This composition primitive inherits ScrollFrame and its theme, viewport and scrolling properties; it accepts repeated children and exposes a vertical list role. It does not add selection, row identity or keyboard navigation: retain those in the typed application model and row components, or use a higher-level kit list.

    For custom virtual lists, call list.ensure-row-visible(index, KitThemes.scroll-behavior(theme)); Slint mounts the requested row without materializing the entire model. Invalid indices do nothing. ScrollFrame.scroll-to({ x: 0px, y: 100px }, ScrollBehavior.instant) restores the positive content position corresponding to content-y: -100px. For a nested materialized target, call its ensure-visible(...); preserve your stable key independently of its current row index.