egui_taffy: Egui Taffy Ui
Flexible egui layout library that supports CSS Block, Flexbox, Grid layouts. It uses high-performance taffy library under the hood.
Egui version compatibility
| egui_taffy | egui | taffy |
|---|---|---|
| 0.1 | 0.29 | 0.6 |
To use add egui_taffy to your project dependencies in Cargo.toml file.
Examples
Check out ./examples/demo.rs (cargo run --example demo).
Flex wrap demo example:
new.show;
Preview:
Grid example
Flex example
Grow demo
Egui options
For best visual look you should enable egui multiple passes support so layout can be immediately recalculated upon some changes.
ctx.options_mut;
If integrating with egui implementations such as bevy_egui, for egui multipass (request_discard) functionality to work you need to use special approach. See bevy_egui simple_multipass example for such case.
Inspiration
This crate is inspired by lucasmerlin previous exploration in this direction by such crates as:
It combines ideas from both crates and builds upon them to provide easy to use egui like API to write your UI with modern layout support.
It uses egui 0.29 new features intrinsic size and request_discard to request immediate frame redraw (without even drawing the current frame) if layout has changed.
Contributing
Contributions are welcome. Please add your improvements to examples so that it is easy to see and validate.