Skip to content

A fractal

Three levels of nested containers. The strategy changes at each level: a grid of rings of grids.

Edit it

A fractalPlayground →
A fractal: the layout

64 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.

fractal.ts
import { layout } from "ireko";
const input = {
"root": {
"id": "f",
"label": "",
"mode": "nested",
"layout": {
"type": "grid",
"columns": 3
},
"children": [
{
"id": "f.1",
"label": "",
"mode": "nested",
"layout": "radial",
"children": [
{
"id": "f.1.1",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.1.1.1",
"label": ""
},
{
"id": "f.1.1.2",
"label": ""
},
{
"id": "f.1.1.3",
"label": ""
},
{
"id": "f.1.1.4",
"label": ""
}
]
},
{
"id": "f.1.2",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.1.2.1",
"label": ""
},
{
"id": "f.1.2.2",
"label": ""
},
{
"id": "f.1.2.3",
"label": ""
},
{
"id": "f.1.2.4",
"label": ""
}
]
},
{
"id": "f.1.3",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.1.3.1",
"label": ""
},
{
"id": "f.1.3.2",
"label": ""
},
{
"id": "f.1.3.3",
"label": ""
},
{
"id": "f.1.3.4",
"label": ""
}
]
},
{
"id": "f.1.4",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.1.4.1",
"label": ""
},
{
"id": "f.1.4.2",
"label": ""
},
{
"id": "f.1.4.3",
"label": ""
},
{
"id": "f.1.4.4",
"label": ""
}
]
}
]
},
{
"id": "f.2",
"label": "",
"mode": "nested",
"layout": "radial",
"children": [
{
"id": "f.2.1",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.2.1.1",
"label": ""
},
{
"id": "f.2.1.2",
"label": ""
},
{
"id": "f.2.1.3",
"label": ""
},
{
"id": "f.2.1.4",
"label": ""
}
]
},
{
"id": "f.2.2",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.2.2.1",
"label": ""
},
{
"id": "f.2.2.2",
"label": ""
},
{
"id": "f.2.2.3",
"label": ""
},
{
"id": "f.2.2.4",
"label": ""
}
]
},
{
"id": "f.2.3",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.2.3.1",
"label": ""
},
{
"id": "f.2.3.2",
"label": ""
},
{
"id": "f.2.3.3",
"label": ""
},
{
"id": "f.2.3.4",
"label": ""
}
]
},
{
"id": "f.2.4",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.2.4.1",
"label": ""
},
{
"id": "f.2.4.2",
"label": ""
},
{
"id": "f.2.4.3",
"label": ""
},
{
"id": "f.2.4.4",
"label": ""
}
]
}
]
},
{
"id": "f.3",
"label": "",
"mode": "nested",
"layout": "radial",
"children": [
{
"id": "f.3.1",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.3.1.1",
"label": ""
},
{
"id": "f.3.1.2",
"label": ""
},
{
"id": "f.3.1.3",
"label": ""
},
{
"id": "f.3.1.4",
"label": ""
}
]
},
{
"id": "f.3.2",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.3.2.1",
"label": ""
},
{
"id": "f.3.2.2",
"label": ""
},
{
"id": "f.3.2.3",
"label": ""
},
{
"id": "f.3.2.4",
"label": ""
}
]
},
{
"id": "f.3.3",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.3.3.1",
"label": ""
},
{
"id": "f.3.3.2",
"label": ""
},
{
"id": "f.3.3.3",
"label": ""
},
{
"id": "f.3.3.4",
"label": ""
}
]
},
{
"id": "f.3.4",
"label": "",
"mode": "nested",
"layout": "grid",
"children": [
{
"id": "f.3.4.1",
"label": ""
},
{
"id": "f.3.4.2",
"label": ""
},
{
"id": "f.3.4.3",
"label": ""
},
{
"id": "f.3.4.4",
"label": ""
}
]
}
]
}
]
}
};
const result = layout(input, {"nodeSize":{"width":28,"height":28},"spacing":8,"header":14});