Skip to content

Yoga

A layout engine that positions boxes on screen using flexbox rules, usable from many languages.

Stars
18.9k
Forks
1.6k
Licence
MIT
Language
C++
Last update
4 days ago
Type
Library

What it is

Yoga is an embeddable flexbox layout engine. It calculates where each element goes and how big it should be, so other software can place items on screen without writing its own layout logic. The README describes it as having bindings for multiple languages, and it is available through npm, Maven Central, and Swift Package Manager.

  • Embed a flexbox layout engine in an app written in another language via its bindings
  • Run the C++ unit tests with the provided unit_tests script
  • Add new HTML-based layout fixtures and generate tests from them with yarn gentest

Great for

  • Developers embedding flexbox-style layout into a native or cross-platform app
  • Teams who want the same layout rules across several languages
  • Contributors who want to work on the C++ layout core and its unit tests

Not ideal for

  • People who just want to build a web page; the README does not describe a standalone website tool
  • Non-programmers, since it is a code library with no visual interface
Step-by-step guide: how to use YogaInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: C++ 20 compiler · CMake · yarn classic (only for generating tests)

    Run unit tests (Debug)

    ./unit_tests Debug

    Run unit tests (Release)

    ./unit_tests Release

    Install dependencies for the test generator

    yarn install

    Generate tests from fixtures

    yarn gentest
  2. 2

    Run it

    • Clone the repository and build the main library with CMake
    • Run ./unit_tests Debug to confirm the build works
    • Optionally add an HTML fixture under gentest/fixtures and run yarn gentest
  3. 3

    Get the most out of it

    • Use ninja if installed to speed up builds, as the README notes
    • Add HTML fixtures to gentest/fixtures to produce new generated layout tests
    • Use the VSCode launch.json configuration to debug unit tests with breakpoints

Downloads

Strengths

  • Based on flexbox, a layout model many developers already know
  • Available through several package ecosystems (npm, Maven Central, SPM)
  • MIT licensed and widely starred

Trade-offs

  • The README is short and gives little detail on the API or bindings
  • Building requires C++ 20 and CMake, which is not trivial for beginners
  • Latest release has no prebuilt binaries, so you typically build or install through a package manager

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.