TUI support is currently quite experimental. Even the project name will change. But, if you're willing to venture into the realm of the unknown, this guide will get you started.
To tinker with TUI support, start by making a new package and adding our TUI package from git.
$ cargo new --bin demo
$ cd demo
$ cargo add dioxus
$ cargo add rink --git https://github.com/DioxusLabs/rink.git
Then, edit your main.rs
with the basic template.
// main
use dioxus::prelude::*;
fn main() {
let mut dom = VirtualDom::new(app);
dom.rebuild();
rink::render_vdom(&mut dom).unwrap();
}
fn app(cx: Scope) -> Element {
cx.render(rsx! {
div {
width: "100%",
height: "10px",
background_color: "red",
justify_content: "center",
align_items: "center",
"Hello world!"
}
})
}
To run our app:
$ cargo run
Press "q" to close the app (yes, this is hardcoded, we are working on handlers to expose this in your code.)
Make sure to read the Dioxus Guide if you already haven't!