Taffy is a high-performance UI layout library written in Rust that implements CSS layout algorithms.
The tool solves the problem of computing UI element positions and sizes across different platforms by implementing the CSS Block, Flexbox, and CSS Grid layout algorithms. It is designed as a dependency for other UI and GUI libraries rather than as a standalone application, allowing projects to leverage battle-tested layout specifications without building their own layout engine. The library faithfully implements the Flexbox and CSS Grid specifications, meaning developers can apply knowledge from web CSS directly to their projects.
Taffy suits projects that need reliable, performant layout computation in Rust, particularly game engines, terminal UI frameworks, and native GUI toolkits. It is already integrated into several established projects including Bevy, Servo, Slint, and the Lapce and Zed text editors. The tool is designed as a collaborative cross-team project, making it suitable for teams that want to avoid duplicating layout logic. Language bindings exist or are in development for Python and WebAssembly, expanding its reach beyond pure Rust projects.
The project maintains active development with regular contributions addressing layout edge cases and specification compliance. The roadmap indicates planned support for additional layout paradigms beyond the currently implemented Block, Flexbox, and CSS Grid algorithms. Development activity shows ongoing refinement of the layout implementations and expansion of the tool's capabilities to cover more CSS layout scenarios.