8000 GitHub - DJMcNab/floem: A native Rust UI library with fine-grained reactivity · GitHub
[go: up one dir, main page]

Skip to content
7FFF
DJMcNabPublic
forked from lapce/floem

About

A native Rust UI library with fine-grained reactivity

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

227 Commits

Folders and files

Repository files navigation

Floem

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 (couter, set_counter) = create_signal(0);

    // create user interface with Floem view functions
    stack(|| {
        (
            label(move || format!("Value: {}", couter.get())),
            stack(|| {
                (
                    label(|| "Increment".to_string())
                        .on_click(move |_| {
                            set_counter.update(|value| *value += 1);
                            true
                        }),
                    label(|| "Decrement".to_string())
                        .on_click(move |_| {
                            set_counter.update(|value| *value -= 1);
                            true
                        }),
                )
            }),
        )
    })
}

fn main() {
    floem::launch(app_view);
}

Features

Inspired by Xilem, Leptos and rui, Floem aims to be a high performance declarative UI library with minimal effort from the user.

  • Cross-platform support: Supports Windows, macOS and Linux with rendering on Wgpu. A software renderer is also planned in case of GPU is unavailable.
  • Fine-grained reactivity: The entire library is built around reactive primitives provided by leptos_reactive. The reactive "signals" give the user a nice way to do state management in a performant way.
  • Performance: The view tree is only run once, so the user can't accidentally put something expensive in the view generation function which slows down the whole application. The library also provides tools to help user to write performant UI code. More on the virtual list example
  • Flexbox layout: Using taffy, the library provides the Flexbox layout system, which can be applied to any View node.

Contributions

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.

About

A native Rust UI library with fine-grained reactivity

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0