Skip to main content

quickstart/
quickstart.rs

1use sui::prelude::*;
2
3fn main() -> Result<()> {
4    let theme = DefaultTheme::light();
5
6    let content = Stack::vertical()
7        .gap(12.0)
8        .alignment(Alignment::Start)
9        .with_child(
10            Label::new("Your first SUI window")
11                .theme(theme)
12                .font_size(24.0)
13                .line_height(30.0)
14                .color(theme.palette.text),
15        )
16        .with_child(
17            Label::new("Widgets are retained Rust values arranged into one tree.")
18                .theme(theme)
19                .color(theme.palette.text_muted),
20        )
21        .with_child(
22            Button::new("Say hello")
23                .theme(theme)
24                .on_press(|| println!("Hello from SUI!")),
25        );
26
27    let root = Surface::window(content)
28        .theme(theme)
29        .padding(Insets::all(24.0))
30        .fill();
31
32    App::new()
33        .window(Window::new("SUI Quickstart").root(root))
34        .run()
35}