35 releases (14 breaking)

0.19.0-alpha.2 Jan 26, 2024
0.17.0 Jan 20, 2024
0.16.4 Dec 16, 2023
0.8.0 Nov 30, 2023
0.1.0 Jan 23, 2023

#803 in GUI


Used in 3 crates

MIT/Apache

20KB
479 lines

Concoct is a framework for user-interfaces in Rust.

This crate provides a virtual DOM and state management system for any backend. Concoct uses static typing to describe your UI at compile-time to create an efficient tree without allocations.

#[derive(Default)]
struct Counter {
    count: i32,
}

impl View<Counter> for Counter {
    fn body(&mut self, _cx: &Scope<Counter>) -> impl View<Counter> {
        (
            format!("High five count: {}", self.count),
            html::button("Up high!").on_click(|state: &mut Self, _event| state.count += 1),
            html::button("Down low!").on_click(|state: &mut Self, _event| state.count -= 1),
        )
    }
}

Dependencies

~1MB
~21K SLoC