lapce / floem
- воскресенье, 12 ноября 2023 г. в 00:00:11
A native Rust UI library with fine-grained reactivity
A native Rust UI library with fine-grained reactivity
It's still early days so expect lots of things missing!
fn app_view() -> impl View {
// create a counter reactive signal with initial value 0
let (counter, set_counter) = create_signal(0);
// create user interface with Floem view functions
stack((
label(move || format!("Value: {}", counter.get())),
stack((
text("Increment")
.on_click(move |_| {
set_counter.update(|value| *value += 1);
true
}),
text("Decrement")
.on_click(move |_| {
set_counter.update(|value| *value -= 1);
true
}),
)),
))
}
fn main() {
floem::launch(app_view);
}
Inspired by Xilem, Leptos and rui, Floem aims to be a high performance declarative UI library with minimal effort from the user.
Contributions welcome! If you'd like to improve how Floem works and fix things, feel free to open an issue or submit a PR. If you'd like a conversation with Floem devs, you can join in the #floem channel on this Discord.