# yoga-layout

> An embeddable and performant flexbox layout engine with bindings for multiple languages

Latest version **3.2.1** (published 2024-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install yoga-layout
pnpm add yoga-layout
yarn add yoga-layout
bun add yoga-layout
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2024-12-13 |
| First published | 2017-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 219 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 18912 |
| Author | Meta Open Source |
| Maintainers | fb |

## Links

- npm: https://www.npmjs.com/package/yoga-layout
- Repository: git@github.com:facebook/yoga
- Homepage: https://yogalayout.dev/
- npm.io page: https://npm.io/package/yoga-layout

## Recent versions

- 3.2.1 (latest) — 2024-12-13
- 3.2.0 — 2024-12-02
- 3.1.0 — 2024-06-23
- 3.0.4 — 2024-04-17
- 3.0.3 — 2024-04-09
- 3.0.2 — 2024-03-13
- 3.0.1 — 2024-03-13
- 3.0.0 — 2024-03-06
- 2.0.1 — 2023-11-01
- 2.0.0 — 2023-07-27
- 2.0.0-beta.2 — 2023-07-13
- 2.0.0-beta.1 — 2023-06-29
- 1.9.3 — 2018-02-15
- 1.9.2 — 2018-02-15
- 1.9.0 — 2018-01-19
- … 5 more at https://npm.io/package/yoga-layout/versions

## README

# yoga-layout

This package provides prebuilt WebAssembly bindings for the Yoga layout engine.

See more at https://yogalayout.dev

## Usage

```ts
import {Yoga, Align} from 'yoga-layout';

const node = Yoga.Node.create();
node.setAlignContent(Align.Center);
```

Objects created by `Yoga.<>.create()` are not automatically garbage collected and should be freed once they are no longer in use.

```ts
// Free a config
config.free();

// Free a tree of Nodes
node.freeRecursive();

// Free a single Node
node.free();
```

## Requirements

`yoga-layout` requires a toolchain that supports ES Modules and top-level await.

If top-level-await is not supported, use the `yoga-layout/load` entry point instead. This requires to load yoga manually:

```ts
import {loadYoga, Align} from 'yoga-layout/load';

const node = (await loadYoga).Node.create();
node.setAlignContent(Align.Center);
```

---
_Source: https://npm.io/package/yoga-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
