pixijs-layout
v0.2.0
Published
[](https://github.com/samwho/pixijs-layout/blob/main/LICENSE) [](https://www.npmjs.com/package/pixijs-layout) [
VStack
import { VStack } from "pixijs-layout";
let component = VStack(circle(), circle(), circle()).leaves((leaf) =>
leaf.fit().padding("5%"),
);
HStacks in a VStack
import { VStack, HStack } from "pixijs-layout";
let component = VStack(
HStack(circle(), circle(), circle()),
HStack(circle(), circle(), circle()),
HStack(circle(), circle(), circle()),
).leaves((leaf) => leaf.fit().padding("5%"));
Grid
import { Grid } from "pixijs-layout";
let component = Grid(
circle(),
circle(),
circle(),
circle(),
circle(),
circle(),
circle(),
circle(),
circle(),
).leaves((leaf) => leaf.fit().padding("5%"));
Grid within a grid
import { Grid } from "pixijs-layout";
let component = Grid(
circle(),
circle(),
circle(),
Grid(circle(), circle(), circle(), circle()),
).leaves((leaf) => leaf.fit());
Debugging complex layouts
The .debug() modifier on a stack will add light grey backgrounds to show how
the screen is being divided. The more nested the stack, the darker the grey.
import { Grid } from "pixijs-layout";
let component = Grid(
HStack(circle(), circle()),
VStack(circle(), HStack(circle(), circle())),
Grid(
circle(),
circle(),
circle(),
Grid(circle(), circle(), circle(), circle()),
),
Stack(
Stack(circle(), circle(), circle()),
Stack(circle(), circle(), circle()),
Stack(circle(), circle(), circle()),
),
)
.debug()
.leaves((leaf) => leaf.fit().padding("10%"));
