group
import { group } from 'pixi-silk/ui/blocks';
function group(items: readonly StackItem[], style?: SmartLayout): FlexContainer;
A FlexContainer laid out by style (a row, a column, a box with padding) holding items.
Put it in a surface or in another group: blocks inside it still paint into the surface. It has
no layout loop of its own, so on its own (as a root) it is laid out only by updateLayout().
Parameters#
| Parameter | Type |
|---|---|
items | readonly StackItem[] |
style | SmartLayout |
Returns#
Example#
import { CounterBlock, group, PanelBlock, TextBlock } from 'pixi-silk/ui/blocks';
import { signal } from 'pixi-silk/signal';
const score = signal(0);
const card = group(
[
[new PanelBlock({ radius: 20 }), { position: 'absolute', inset: 0 }],
new TextBlock({ text: 'SCORE', style: { fontSize: 16 } }),
new CounterBlock({ value: score, width: 180, height: 40, style: { fontSize: 32 } }),
],
{ direction: 'column', padding: 16, width: 220 },
);