egui-arbor
A flexible tree/outliner widget for egui - hierarchical data visualization and editing inspired by Blender's outliner.
Version Compatibility
| egui-arbor | egui | bevy | bevy_egui |
|---|---|---|---|
| 0.2.0 | 0.31 | 0.16 | 0.34 |
Note: The
bevyandbevy_eguiversions are only required if you're using the Bevy integration example.
Features
- Hierarchical Tree View: Display nested data structures with collections and entities
- Expand/Collapse: Navigate through tree hierarchy with visual expand/collapse arrows
- Drag & Drop: Reorder and reparent nodes with Before/After/Inside positioning
- Multi-Selection: Full multi-select support with keyboard modifiers (Ctrl/Cmd for toggle, Shift for range)
- Action Icons: Built-in visibility, lock, and selection toggles with custom icon support
- Blender-Style Visibility: Parent visibility changes cascade to all children
- Inline Editing: Double-click to rename nodes with keyboard shortcuts
- Customizable Styling: Configure indentation, colors, icons, and spacing
- Trait-Based Integration: Works with any data structure implementing
OutlinerNode - Bevy Integration: Full support for Bevy game engine with 3D scene synchronization
- egui Memory Integration: Automatic state persistence across frames
Quick Start
Add to your Cargo.toml:
[]
= "0.2"
Basic Example
use ;
// 1. Define your data structure
// 2. Implement OutlinerNode trait
// 3. Implement OutlinerActions trait
// 4. Use in your egui code
Examples
Basic Example
Run the basic example to see all core features in action:
Features demonstrated:
- Tree structure with collections and entities
- All action icons (visibility, lock, selection)
- Drag & drop with visual feedback
- Multi-selection with keyboard modifiers
- Inline renaming with double-click
- Event logging and statistics
- Custom styling options
Bevy 3D Outliner Example
Run the Bevy integration example to see egui-arbor working with a 3D scene:
Features demonstrated:
- Integration with Bevy 0.16.1 game engine
- 3D scene with three collections (Red, Green, Blue)
- Tree outliner synchronized with 3D scene visibility
- Blender-style visibility behavior (parent changes cascade to children)
- Drag and drop to reorganize scene hierarchy
- Inline rename for scene objects
- Orbit camera controls (left mouse: orbit, right mouse: pan, scroll: zoom)
The example creates 9 objects total (3 shapes × 3 colors) arranged in a grid pattern, with a tree outliner on the left side that controls their visibility in real-time.
Core Concepts
OutlinerNode Trait
Implement this trait on your data structure to make it work with the outliner:
OutlinerActions Trait
Handle user interactions by implementing this trait:
Action Icons
Built-in action icons:
- Visibility (👁/🚫): Toggle node visibility
- Lock (🔒/🔓): Prevent modifications
- Selection (☑/☐): Quick selection toggle
- Custom: Define your own with custom icons and tooltips
Drag & Drop
Three drop positions supported:
- Before: Insert before the target node
- After: Insert after the target node
- Inside: Add as child of target (collections only)
Automatic validation prevents invalid operations (e.g., parent into child).
Customization
Custom Styling
use ;
let style = default
.with_indent
.with_row_height
.with_selection_color;
new
.with_style
.show;
Custom Icons
Architecture
egui-arbor follows egui ecosystem conventions:
- User-owned data: You own your data structures
- Trait-based integration: Flexible integration with any data type
- Immediate mode: Widget reconstructed each frame
- egui memory integration: Automatic state persistence
See ARCHITECTURE.md for detailed design documentation.
Optional Features
serde: Enable serialization support for state persistence
[]
= { = "0.2", = ["serde"] }
Minimum Supported Rust Version (MSRV)
Rust 1.76 or later (edition 2024).
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
Inspired by Blender's outliner and designed to integrate seamlessly with the egui ecosystem.