Skip to content

Globals

Declare a global singleton with global Name { /* .. properties or callbacks .. */ } to make properties and callbacks available throughout the entire project. Access them using Name.property.

For example, this can be useful for a common color palette:

global Palette {
in-out property<color> primary: blue;
in-out property<color> secondary: green;
}
export component Example inherits Rectangle {
background: Palette.primary;
border-color: Palette.secondary;
border-width: 2px;
}
slint

Export a global to make it accessible from other files. To reach a global from your business logic in Rust, C++, JavaScript, or Python — setting its properties and implementing its callbacks — re-export it from the file that also exports your main application component:

export global Logic {
in-out property <int> the-value;
pure callback magic-operation(int) -> int;
}
// ...
slint
slint::slint!{
export global Logic {
in-out property <int> the-value;
pure callback magic-operation(int) -> int;
}
export component App inherits Window {
// ...
}
}
fn main() {
let app = App::new();
app.global::<Logic>().on_magic_operation(|value| {
eprintln!("magic operation input: {}", value);
value * 2
});
app.global::<Logic>().set_the_value(42);
// ...
}
rust

To re-expose global properties on a component with two-way bindings, see the Globals chapter of the language reference.


© 2026 SixtyFPS GmbH