百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

egui_taffy

> 编程语言
开源

使用 taffy 为 egui 提供网格、弹性布局和块布局支持

198 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

使用 taffy 为 egui 提供网格、弹性布局和块布局支持

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.

This library is in active development and some breaking changes are expected, but they will be kept as small as possible.

Web Demo of the latest released version.

Version compatibility

egui_taffy egui taffy MSRV
0.14 0.36 0.9.2 1.95
0.13 0.35 0.9.2 1.92
0.12 0.34 0.9.2 1.92
0.11 0.34 0.7.7 1.92
0.10 0.33 0.7.7 1.88
0.9 0.32 0.7.7 1.85
0.8 0.32 0.7.7 1.85
0.7 0.31 0.7.3 1.81
0.6 0.30 0.7.3 1.81
0.5 0.30 0.7 1.83
0.4 0.30 0.7 1.83
0.3 0.29 0.7 1.83
0.2 0.29 0.7 1.83
0.1.2 0.29 0.6 1.83
0.1 0.29 0.6 1.83 (nightly)

To use add egui_taffy to your project dependencies in Cargo.toml file.

See CHANGELOG for changes between versions.

Examples

Check out ./examples/demo.rs (cargo run --example demo).

Flex wrap demo example:

…

Preview:

Button example

Grid example

Flex example

Grow demo

Overflow demo

Supports scrollable elements!

Sticky elements (Sticky row and column in scrollable grid)

https://github.com/user-attachments/assets/07546146-7a90-422b-b291-99b758fd7704

Virtual grid (virtual table rows)

Support grids with equal virtual row height. Rows can contain merged cells (colspan).

https://github.com/user-attachments/assets/a3c8ebba-e72f-44c2-9233-29004b97d070

Egui options

Max passes

For best visual look you should enable egui multiple passes support so layout can be immediately recalculated upon some changes.

rust
ctx.options_mut(|options| {
    options.max_passes = std::num::NonZeroUsize::new(2).unwrap();
});

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.

Text wrapping

By default egui text wrapping tries to utilize as less width as possible. In dynamic layouts it results in text where letters are placed in a column.

Instead you should use one of the following options:

  1. Specify minimal width or width for the elements, set text elements to fill width of the parent.
  2. Set custom egui wrap mode when necessary.
    rust
    tui.wrap_mode(egui::TextWrapMode::Truncate).add(|tui| { ... })
  3. Disable text wrapping:
    rust
    ctx.all_styles_mut(|style| {
      style.wrap_mode = Some(egui::TextWrapMode::Extend);
    });

Inspiration

This crate is inspired by lucasmerlin previous exploration in this direction by such crates as:

  • egui_taffy
  • egui_flex

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.

Library uses intrinsic size and request_discard egui functionality to measure layout and 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.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言