RavenRS · Rust GUI

TreeView

Edit and run the TreeView RavenRS example in your browser. Explore its Rust code and download a Cargo project for desktop and WebAssembly.

One declarative Rust interface, GPU rendering, reactive state and semantic design tokens. Free and open source under MIT OR Apache-2.0.

Rust source

fn tree_view() -> impl View {
    let selected = State::new(Some(String::from("invoices")));
    let opened = State::new(std::collections::BTreeSet::from([String::from("sales")]));
    TreeView::new(vec![
        TreeNode::new("sales", "Sales")
            .icon(IconName::Folder)
            .child(TreeNode::new("invoices", "Invoices").icon(IconName::FileText))
            .child(TreeNode::new("quotes", "Quotes").icon(IconName::FileText)),
        TreeNode::new("stock", "Stock")
            .icon(IconName::Folder)
            .child(TreeNode::new("items", "Items").icon(IconName::FileText)),
        TreeNode::new("reports", "Reports").icon(IconName::FileText),
    ])
    .selected(selected.binding())
    .expanded(opened.binding())
}

The interactive preview loads when JavaScript and WebGPU or WebGL2 are available. You can read the guide and examples here at any time.

More examples