Skip to content
Yoga is a cross-platform layout engine which implements Flexbox. Follow for updates.
Branch: master
Clone or download
davidaurelio and facebook-github-bot `YGNode`: one byte of private storage
Adds one byte of private storage to `YGNode`, intended to be used by Yoga itself.

This is in previously unused alignment space, and won’t cause more memory to be allocated.

Reviewed By: SidharthGuglani

Differential Revision: D15296732

fbshipit-source-id: 3caf0a3cd506e4e324e51c31869c69be5781d476
Latest commit 8dc46c0 May 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Add issue template. Jan 30, 2017
ReactYoga.xcodeproj Adds workspace for more efficient yoga development Mar 26, 2019
YogaDev.xcworkspace Adds workspace for more efficient yoga development Mar 26, 2019
YogaDev/YogaDev.xcodeproj Adds workspace for more efficient yoga development Mar 26, 2019
YogaKit Sample workspace: remove XML comment Mar 22, 2019
android Automatic lint fixes Mar 25, 2019
benchmark Apply clang-format rules Jan 8, 2019
csharp **breaking:** remove `YGNodeGetInstanceCount` May 9, 2019
gentest `gentest`: Fix editing messup Mar 29, 2019
gradle updated gradle build tool version to 3.1.0 and gradle to 4.6 Feb 12, 2019
java added listener in flipper plugin for yoga May 15, 2019
javascript **breaking:** remove `YGNodeGetInstanceCount` May 9, 2019
lib JNI: set language level to C++11 Apr 9, 2019
mode Disable assert code in release builds (define DNDEBUG) Dec 18, 2017
scripts Pin cmake version to 3.6 Feb 14, 2019
tests Fix style property bits May 16, 2019
testutil Travis: Fix C++ compilation May 14, 2019
tools/build_defs Travis: Fix C++ compilation May 14, 2019
website Upgrade prettier to 1.17.0 May 7, 2019
yoga `YGNode`: one byte of private storage May 16, 2019
yogacore Added Copyright Header Oct 24, 2018
.buckconfig Modernize Android build system, bump dependencies Nov 8, 2017
.clang-format Code formatting: allow short inline methods on one line Apr 16, 2019
.clang-format-ignore Add `.clang-format` Jan 8, 2019
.editorconfig Add .editorconfig May 27, 2017
.gitignore Add NDK build for libfb Apr 19, 2017
.gitmodules Add googletest submodule Nov 16, 2016
.swift-version Release a new version to cocoapods Mar 29, 2019
.travis.yml Fix Travis build (#800) Aug 2, 2018
BUCK Remove c++1y compiler flag May 14, 2019
CMakeLists.txt Fix cmake build / update CMakeLists.txt to use C++11 (#887) May 14, 2019 Update CoC for various projects Aug 2, 2018 Update CoC for various projects Aug 2, 2018
LICENSE Update copyright headers to yearless format Sep 11, 2018
LICENSE-examples example license Dec 7, 2016 Fix typo Aug 13, 2018
Yoga.podspec v1.14.0 Apr 8, 2019
YogaKit.podspec v1.14.0 Apr 8, 2019
build.gradle updated gradle build tool version to 3.1.0 and gradle to 4.6 Feb 12, 2019 Enable black for xplat/yoga Apr 11, 2019 Add `-SNAPSHOT` to gradle version Apr 8, 2019
gradlew Bundle gradle wrapper Apr 19, 2017
gradlew.bat add missing gradle script for windows May 14, 2019
settings.gradle Added Copyright Header Oct 24, 2018
third-party(Yoga).xcconfig Adds workspace for more efficient yoga development Mar 26, 2019

Yoga CocoaPods npm bintray NuGet


Yoga builds with buck. Make sure you install buck before contributing to Yoga. Yoga's main implementation is in C, with bindings to supported languages and frameworks. When making changes to Yoga please ensure the changes are also propagated to these bindings when applicable.


For testing we rely on gtest as a submodule. After cloning Yoga run git submodule init followed by git submodule update.

For any changes you make you should ensure that all the tests are passing. In case you make any fixes or additions to the library please also add tests for that change to ensure we don't break anything in the future. Tests are located in the tests directory. Run the tests by executing buck test //:yoga.

Instead of manually writing a test which ensures parity with web implementations of Flexbox you can run gentest/gentest.rb to generate a test for you. You can write html which you want to verify in Yoga, in gentest/fixtures folder, such as the following.

<div id="my_test" style="width: 100px; height: 100px; align-items: center;">
  <div style="width: 50px; height: 50px;"></div>

Run gentest/gentest.rb to generate test code and re-run buck test //:yoga to validate the behavior. One test case will be generated for every root div in the input html.

You may need to install the latest watir-webdriver gem (gem install watir-webdriver) and ChromeDriver to run gentest/gentest.rb Ruby script.


.NET testing is not integrated in buck yet, you might need to set up .NET testing environment. We have a script which to launch C# test on macOS, csharp/tests/Facebook.Yoga/


Benchmarks are located in benchmark/YGBenchmark.c and can be run with buck run //benchmark:benchmark. If you think your change has affected performance please run this before and after your change to validate that nothing has regressed. Benchmarks are run on every commit in CI.


Installing through NPM

npm install yoga-layout

By default this will install the library and try to build for all platforms (node, browser asm, and standalone webpack). You may receive errors if you do not have the required platform development tools already installed. To preset the platform you'd like to build for you can set a .npmrc property first.

npm config set yoga-layout:platform standalone

This will now only run the standalone webpack build upon install.

Build Platforms

name description
all (default) Builds all of these platforms.
browser Builds asm js browser version.
node Builds node js version.
standalone Runs webpack.
none Does nothing. You can use the prepackaged libs.
You can’t perform that action at this time.