Skip to content

ColumnContainer

ColumnContainer lays out its child items vertically in a single column. It divides the available height among children, optionally honoring fixed heights for items that specify a size, and then draws each child side-by-side.

$container->setGap(20); // 20px vertical space between items
$container = new ColumnContainer;
$container->addItem(new Rectangle(draw(fill: '#fee2e2')));
$container->addItem(new Rectangle(draw(fill: '#fca5a5')));
$container->addItem(new Rectangle(draw(fill: '#dc2626')));
$container->addItem(new Rectangle(draw(fill: '#450a0a')));
// Draw container onto image
$container->draw($imagick, $x, $y, $width, $height);

Four rectangles stacked vertically, each taking an equal share of the height

The same layout as a template:

{
"type": "column",
"children": [
{ "type": "rectangle", "fill": "#fee2e2" },
{ "type": "rectangle", "fill": "#fca5a5" },
{ "type": "rectangle", "fill": "#dc2626" },
{ "type": "rectangle", "fill": "#450a0a" }
]
}

llms.txt