Grid Layout Config
Configuration for Mermaid's built-in grid layout.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
placements | Record<string, GridPlacement | [GridPlacement, ...GridPlacement[]]> | {} | Placement map keyed by the authored placement ID when present; otherwise, by the emitted node ID. Non-empty arrays target repeated IDs in source order; a single object is equivalent to a one-item array. |
columns | integer | 0 | Non-negative candidate column count for auto-placement. 0 means automatic. |
rowGap | number | 50 | Pixel gap between occupied rows. |
columnGap | number | 50 | Pixel gap between occupied columns. |
cellGap | number | 20 | Pixel gap between items that explicitly share one cell. |
containerPadding | number | 20 | Minimum padding inside groups. |
titleGap | number | 8 | Clearance between a measured group title and the child grid. |
horizontalAlign | left | center | right | center | Default horizontal item alignment. |
verticalAlign | top | center | bottom | center | Default vertical stack alignment. |
curve | basis | bumpX | bumpY | cardinal | catmullRom | linear | monotoneX | monotoneY | natural | step | stepAfter | stepBefore | rounded | rounded | Curve style used to render grid edges. |
edgeCornerRadius | number | 5 | Pixel radius used for grid edges when curve is rounded. |
lineHops | 'arc' | 'gap' | false | 'arc' | Draws edge crossings as arcs (default), visible gaps, or plain crossings when false. Preserves corner radii and arrowhead offsets; smoothing curves such as basis are left unchanged. |
GridPlacement
| Property | Type | Description |
|---|---|---|
row | integer | Safe integer row number local to the direct parent group, including zero and negative values. |
column | integer | Safe integer column number local to the direct parent group, including zero and negative values. |
horizontalAlign | left | center | right | Item alignment within the resolved cell. |
verticalAlign | top | center | bottom | Stack alignment within the resolved cell. |