Taffy: A High-Performance Rust UI Layout Library That Powers Servo, Bevy, and Zed
Taffy: A flexible, high-performance, cross-platform UI layout library
Taffy is a flexible, cross-platform UI layout library written in Rust, implementing CSS Block, Flexbox, and Grid algorithms. It's used by major projects like Servo, Bevy, and Zed. Benchmarks show it often outperforms Facebook's Yoga, especially on deep trees. The library offers bindings for Python and is under active development with WIP C and WASM bindings.
Taffy implements the Flexbox and CSS Grid specifications faithfully, so documentation designed for the web should translate cleanly to Taffy's implementation.
- nicoburns
I maintain Taffy: AMA.
I am currently in the process of building a wider browser engine / GUI toolkit on top of it (https://github.com/dioxuslabs/blitz). As part of that I am implementing a lot of the messier parts of CSS layout (floats, etc), and also grinding on fixing all the WPT tests which we track here: https://blitz.is/status/wpt/css/css-flexbox.
The vision is a complete standalone implementation of the web layout algorithms that can be easily embedded (with individual algorithms enabled/disabled on a pay what you use basis), and which can also be part of a modular ecosystem of browser engine components that make it easier for people to create new browser engines.
Beyond Blitz, some notable users are:
- Servo which uses it only for CSS Grid
- Zed which uses it via it's GPUI toolkit.
- hereonout2
An unfortunate name for certain audiences in the UK!
- chrisweekly
Closely-related tangent: for an amazing resource showing how to leverage CSS from first principles, see https://every-layout.dev