Sigil

Counter

A count and an Increment button: the smallest app, in a window or a terminal.

Captured on the window and terminal host. Source: crates/sigil/examples/hello-counter.rs

GUI · window host

Counter, window host, light themeCounter, window host, dark theme

TUI · terminal host

Source

use sigil::prelude::*; fn main() -> sigil::AppResult<()> {    sigil::run(        AppConfig::new("Sigil - hello-counter").size(480, 240),        app_tree,    )} pub(crate) fn app_tree() -> impl IntoNode {    let count = signal(0_i32);    column()        .layout(LayoutStyle::default().padding(32.0))        .bg(Token::Surface)        .child(text(move || format!("Count: {}", count.get())))        .child(            button("Increment")                .primary()                .activate(move || count.update(|n| *n += 1)),        )}
use sigil::prelude::*; fn main() -> sigil::AppResult<()> {  sigil::run(    AppConfig::new(      "Sigil - hello-counter",    )    .size(480, 240),    app_tree,  )} pub(crate) fn app_tree() -> impl IntoNode{  let count = signal(0_i32);  column()    .layout(      LayoutStyle::default()        .padding(32.0),    )    .bg(Token::Surface)    .child(text(move || {      format!("Count: {}", count.get())    }))    .child(      button("Increment")        .primary()        .activate(move || {          count.update(|n| *n += 1)        }),    )}