# dioxuslabs/taffy

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/dioxuslabs-taffy).**

2,972 stars · 167 forks · Rust · other

## Links

- GitHub: https://github.com/DioxusLabs/taffy
- Homepage: https://docs.rs/taffy
- awesome-repositories: https://awesome-repositories.com/repository/dioxuslabs-taffy.md

## Topics

`css-grid` `flexbox` `hacktoberfest` `layout` `rust` `ui`

## Description

Taffy is a layout engine that calculates the size and position of user interface components. It is a language-agnostic tool that computes element geometry using Flexbox and Grid algorithms.

The engine operates on custom tree structures and node storage through a trait-based interface. This design allows it to be integrated into various programming languages and custom memory management systems.

The system handles UI layout computation, including leaf node measurement and floating point pixel snapping to prevent blurring on displays. It utilizes layout result caching to avoid redundant calculations for unchanged elements.

## Tags

### Graphics & Multimedia

- [Flexbox and Grid Layouts](https://awesome-repositories.com/f/graphics-multimedia/web-standard-rendering/flexbox-and-grid-layouts.md) — Provides a full implementation of Flexbox and Grid layout models for computing element geometry.

### Part of an Awesome List

- [Cross Platform Layout Libraries](https://awesome-repositories.com/f/awesome-lists/devtools/cross-platform-layout-libraries.md) — Provides flexbox layout capabilities to non-web environments as a language-agnostic library.

### Software Engineering & Architecture

- [Recursive Layout Measurement](https://awesome-repositories.com/f/software-engineering-architecture/recursive-layout-measurement.md) — Traverses the view hierarchy to calculate the dimensions of leaf nodes based on external content. ([source](https://docs.rs/taffy))
- [Node Storage Abstractions](https://awesome-repositories.com/f/software-engineering-architecture/resource-abstraction-interfaces/tree-node-abstractions/node-storage-abstractions.md) — Provides a trait-based interface that abstracts node storage, allowing for custom tree implementations.
- [Caching and Memoization](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-optimization/caching-memoization.md) — Utilizes memoization to cache previously computed layout geometry and avoid redundant calculations.

### User Interface & Experience

- [Agnostic Layout Trees](https://awesome-repositories.com/f/user-interface-experience/agnostic-layout-trees.md) — Implements a layout engine that operates on any custom tree structure via a trait-based interface.
- [Element Positioning](https://awesome-repositories.com/f/user-interface-experience/element-positioning.md) — Computes the spatial arrangement and coordinate locations of nested UI components.
- [Tree-Based Layout Logic](https://awesome-repositories.com/f/user-interface-experience/layout-components/custom-layouts/tree-based-layout-logic.md) — Allows the use of custom tree implementations to manage node storage and caching during layout. ([source](https://docs.rs/taffy))
- [Pixel Snapping](https://awesome-repositories.com/f/user-interface-experience/pixel-snapping.md) — Converts calculated floating point coordinates to integer pixel values to prevent sub-pixel blurring.
- [UI Geometry Calculation Tools](https://awesome-repositories.com/f/user-interface-experience/ui-geometry-calculation-tools.md) — Calculates the size and position of UI components with built-in support for pixel snapping and caching.
- [Cross-Platform Rendering Frameworks](https://awesome-repositories.com/f/user-interface-experience/layout-utilities/presentation-engines/cross-platform-rendering-frameworks.md) — Functions as a cross-platform rendering framework by providing consistent geometry calculations across different environments.
- [Custom UI Frameworks](https://awesome-repositories.com/f/user-interface-experience/user-interface-frameworks/custom-ui-frameworks.md) — Serves as a foundational component for building custom UI frameworks by providing the core layout logic.

### Data & Databases

- [Layout Tree Storage Interfaces](https://awesome-repositories.com/f/data-databases/append-only-storage-engines/layout-tree-storage-interfaces.md) — Taffy enables connecting layout algorithms to custom data structures and memory management systems through a low-level interface. ([source](https://docs.rs/taffy/0.11.0/taffy/))
- [Computational Result Caching](https://awesome-repositories.com/f/data-databases/key-value-stores/response-caching/computational-result-caching.md) — Caches computed layout geometry to skip redundant calculations for unchanged elements. ([source](https://docs.rs/taffy))

### Operating Systems & Systems Programming

- [Arena-Based Memory Management](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/arena-based-memory-management.md) — Implements arena-based memory management to organize layout nodes in contiguous blocks for improved cache locality.
