Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.23 KB

File metadata and controls

29 lines (21 loc) · 1.23 KB

Windows Reactor

Windows Reactor is a declarative UI library for Rust developers, backed by WinUI 3. It uses a React-like component model — render functions, hooks for state, and a builder-pattern DSL for composing UI elements.

A minimal app defines a render function fn(&mut RenderCx) -> Element and passes it to App::render:

use windows_reactor::*;

fn app(cx: &mut RenderCx) -> Element {
    let (count, set_count) = cx.use_state(0_i32);

    vstack((
        text_block(format!("count = {count}")).font_size(18.0).bold(),
        button("Click").on_click(move || set_count.call(count + 1)),
    ))
    .spacing(12.0)
    .into()
}

fn main() -> windows_core::Result<()> {
    App::new().title("My App").render(app)
}

Widget builders convert to Element via .into(), and cx.use_state returns the current value plus a handle whose call schedules a rerender. See the reactor guide for components, hooks, layout, styling, and the full widget catalog.