Cross-platform user interface framework for Rust.
This crate provides an HTML-like render API for the backend of a UI. It's built for use as a backend for concoct, but you can bring your own state management tools or build your own framework using this as a backend.
```rust let mut tree = Tree::default(); let root = Element::builder() .alignitems(AlignItems::Center) .justifycontent(JustifyContent::Center) .child(tree.insert("Hello World!")) .build(&mut tree);
viewbuilder::run(tree, root) ```
rust
fn button(
tree: &mut Tree,
label: &'static str,
mut f: impl FnMut(&mut Tree) + 'static,
) -> ElementKey {
Element::builder()
.on_click(Box::new(move |tree, _event| f(tree)))
.background_color(Color4f::new(1., 1., 0., 1.))
.child(tree.insert(label))
.build(tree)
}