Skip to content

Your first window

Windows are built with Slint: you design the UI in a .slint file (like WPF’s XAML) and write the behavior in Rust.

  1. Create the project: Nuevo → Aplicación de ventana (window app). It creates src/main.rs and ui/app-window.slint with a working example.

  2. Open the designer by clicking ui/app-window.slint. It opens in Diseño (Design) view.

  3. Add a button: drag it from the Caja de herramientas (Toolbox) onto the window, and set its text and name in Propiedades (Properties).

  4. Handle the click: Eventos (Events) tab → Al hacer clic (On click) → Crear (Create). Raxorin Studio declares the callback in the .slint file and writes the handler in main.rs:

    src/main.rs
    ui.on_clear_clicked({
    let ui_handle = ui.as_weak();
    move || {
    let ui = ui_handle.unwrap();
    // What happens on click.
    }
    });