#widgets #tree #egui #node-tree

egui_ltreeview

A tree view widget for egui

4 releases

new 0.1.10 Mar 14, 2025
0.1.9 Mar 9, 2025
0.1.8 Mar 9, 2025
0.1.7 Mar 9, 2025

#191 in GUI

Download history 276/week @ 2025-03-05 121/week @ 2025-03-12

397 downloads per month
Used in gled

MIT license

87KB
1.5K SLoC

egui_ltreeview is a tree view widget for egui

github crates.io docs.rs egui_version

This tree view widget implements all the common features of a tree view to get you up and running as fast as possible.

Features:

  • Directory and leaf nodes
  • Node selection
  • Select multiple nodes
  • Keyboard navigation using arrow keys
  • Frontend for Drag and Drop support
  • Agnostic to the implementation of your data.

Getting started

let id = ui.make_persistent_id("Names tree view");
TreeView::new(id).show(ui, |builder| {
    builder.dir(0, "Root");
    builder.leaf(1, "Ava");
    builder.leaf(2, "Benjamin");
    builder.leaf(3, "Charlotte");
    builder.close_dir();
});

Create a new TreeView with its unique id and show it for the current ui. Use the builder in the callback to add directories and leaves to the tree. The nodes of the tree must have a unqiue id which implements the NodeId trait.

Examples

The examples folder contains a few examples to get you up and running quickly. It also contains a playground example witch implements every feature of this widget and lets you change its settings on the fly. You can run it using cargo run --example playground.

Demo

Demo showing selection, moving and creation of files in the tree view

Dependencies

~4.5–9.5MB
~93K SLoC