yoga-layout

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

See more at https://yogalayout.dev

Usage

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.

// 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:

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

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

yoga-layout - Installation

To install yoga-layout via this registry, you'll need to install via the --registry parameter with your package manager.

n

NPM

npm install yoga-layout --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Yarn

yarn config set registry https://js.registry.sudovanilla.org
yarn install yoga-layout

Learn more about the config option.

PNPM

pnpm install yoga-layout --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Bun Logo

Bun

bun install yoga-layout --registry https://js.registry.sudovanilla.org

Learn more about the --registry parameter.

Learn more about setting this up in your bunfig.toml configuration.


For Deno, add the following to your .npmrc file in your directory:

registry="https://js.registry.sudovanilla.org"

Then run the deno install command.

yoga-layout - Download

Download Tarball (v3.2.1)

Integrity sha512-0LPOt3AxKqMdFBZA3HBAt/t/8vIKq7VaQYbuA8WxCgung+p9TVyKRYdpvCb80HcdTN2NkbIKbhNwKUfm3tQywQ==
SHASUM d2d1ba06f0e81c2eb650c3e5ad8b0b4adde1e843
Tarball https://js.registry.sudovanilla.org/yoga-layout/-/yoga-layout-3.2.1.tgz