Crates.io | floem |
lib.rs | floem |
version | 0.1.1 |
source | src |
created_at | 2023-11-21 22:35:17.414644 |
updated_at | 2024-01-13 22:03:56.949342 |
description | A native Rust UI library with fine-grained reactivity |
homepage | |
repository | https://github.com/lapce/floem |
max_upload_size | |
id | 1044695 |
size | 619,549 |
The project is still maturing. We will make occasional breaking changes and add missing features on our way to v1.
use floem::reactive::create_signal;
use floem::view::View;
use floem::views::{h_stack, label, v_stack, Decorators};
use floem::widgets::button;
fn app_view() -> impl View {
// Create a reactive signal with a counter value, defaulting to 0
let (counter, set_counter) = create_signal(0);
// Create a vertical layout
v_stack((
// The counter value updates automatically, thanks to reactivity
label(move || format!("Value: {}", counter.get())),
// Create a horizontal layout
h_stack((
button(|| "Increment").on_click_stop(move |_| {
set_counter.update(|value| *value += 1);
}),
button(|| "Decrement").on_click_stop(move |_| {
set_counter.update(|value| *value -= 1);
}),
)),
))
}
fn main() {
floem::launch(app_view);
}
Inspired by Xilem, Leptos and rui, Floem aims to be a high performance declarative UI library requiring minimal user effort.
To sample Floem's capabilities, check out the repo and run the widget gallery example with cargo.
To help you master Floem, we provide documentation and code examples.
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.