Skip to content

Boxes of different sizes

Each column is as wide as its widest box, and each row is as tall as its tallest box.

Edit it

Boxes of different sizesPlayground →
Boxes of different sizes: the layoutboardwidetallsquaresmallmediumlong

7 boxes, 0 edges. The audit finds no defect.

The input

The same layout in TypeScript. The input is plain data, so it can come from JSON.

sizes.ts
import { layout } from "ireko";
const input = {
"root": {
"id": "board",
"mode": "nested",
"layout": {
"type": "grid",
"columns": 3
},
"children": [
{
"id": "wide",
"size": {
"width": 260,
"height": 40
}
},
{
"id": "tall",
"size": {
"width": 60,
"height": 160
}
},
{
"id": "square",
"size": {
"width": 90,
"height": 90
}
},
{
"id": "small",
"size": {
"width": 40,
"height": 30
}
},
{
"id": "medium",
"size": {
"width": 140,
"height": 70
}
},
{
"id": "long",
"size": {
"width": 200,
"height": 50
}
}
]
}
};
const result = layout(input);