stack
import { stack } from 'pixi-silk/ui/blocks';
function stack(
parent: FlexContainer,
items: readonly StackItem[],
style?: SmartLayout
): FlexContainer;
Adds items to parent in order: blocks with Block.layout, other containers with the
given style or none. With style, the items go into a new group first, and the group
goes into parent. Returns the container the items went into.
Parameters#
| Parameter | Type |
|---|---|
parent | FlexContainer |
items | readonly StackItem[] |
style? | SmartLayout |
Returns#
Example#
import { BlockSurface, ButtonBlock, stack } from 'pixi-silk/ui/blocks';
const bar = new BlockSurface({ viewport: app, landscapeData: { width: 1920, height: 160, valign: 'bottom' } });
const a = new ButtonBlock({ width: 80, height: 80, shape: 'circle', label: 'A', onPress: () => {} });
const b = new ButtonBlock({ width: 80, height: 80, shape: 'circle', label: 'B', onPress: () => {} });
// a column of two buttons inside the bar
stack(bar, [a, b], { direction: 'column', gap: 12 });