Viewbuilder

Crates.io version docs.rs docs CI status
Examples


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.

Features

Examples

Hello World

```rust fn app(cx: &mut Context) -> NodeKey { Element::new() .alignitems(AlignItems::Center) .justifycontent(JustifyContent::Center) .child(cx.insert("Hello World!")) .build(cx) }

fn main() { viewbuilder::run(app) } ```

Button Component

rust fn button( cx: &mut Context, label: &'static str, mut handler: impl FnMut(&mut Context) + 'static, ) -> NodeKey { Element::new() .on_click(Box::new(move |cx, _event| handler(cx))) .background_color(Color4f::new(1., 1., 0., 1.)) .child(cx.insert(label)) .build(cx) }