Taffy: A flexible, high-performance, cross-platform UI layout library
Published: 2026-08-19
Taffy is a flexible, high-performance, cross-platform UI layout library written in Rust . It currently implements the CSS Block , Flexbox and CSS Grid layout algorithms. Support for other paradigms is planned. For more information on this and other future development plans see the roadmap issue . This crate is a collaborative, cross-team project, and is designed to be used as a dependency for other UI and GUI libraries. Right now, it powers: Servo : an alternative web browser Blitz : a radically modular web engine Bevy : an ergonomic, ECS-first Rust game engine Takumi : Renders your React components to images iocraft : crafting beautiful interfaces for the terminal Slint : a declarative GUI toolkit for building native user interfaces The Lapce text editor via the Floem UI framework The Zed text editor via the GPUI UI framework Usage use taffy::prelude::*; // First create an instance of TaffyTree let mut tree : TaffyTree<()> = TaffyTree::new(); // Create a tree of nodes using `TaffyTree.new_leaf` and `TaffyTree.new_with_children`. // These functions both return a node id which can be used to refer to that node // The Style struct is used to specify styling information let header_node = tree .new_leaf( Style { size: Size { width: length(800.0), height: length(100.0) }, ..Default::default() }, ).unwrap(); let body_node = tree .new_leaf( Style { size: Size { width: length(800.0), height: auto() }, flex_grow: 1.0, ..Default::default() }, ).unwrap(); let root_node = tree .new…
Originally sourced from Hacker News