Skip to content
D
Documentation

UnifiedLayoutOptions

reference
2 min readUpdated

Import it from @grafloria/engine.

Also has every member of LayoutOptions, LayoutRunOptions, listed on their own entries.

The one options schema. Adapter-specific knobs still ride in options, but everything that is common to all layouts is named here so callers do not have to learn five different vocabularies.

ts
interface UnifiedLayoutOptions extends Partial<LayoutOptions>, LayoutRunOptions

Properties

NameTypeDefaultDescription
seed?numberSeed for any algorithm that uses randomness (force, spectral, community). Defaults to a FIXED constant — so an author who never thinks about seeds still gets the same picture every time. Randomness is opt-in.
direction?FlowDirectionPrimary flow direction, normalised across engines: dagre calls it rankdir, ELK calls it elk.direction, and the two disagree about spelling. Callers say direction and the registry translates.
nodeSpacing?numberSpace between nodes in the same rank/row.
rankSpacing?numberSpace between ranks/layers.
nested?booleanLay groups out as CONTAINERS: each group's contents are arranged recursively (deepest first), the container is auto-sized to fit them, and the parent level then arranges containers as COMPOUND NODES — with edges that cross a container boundary induced onto the compound nodes so the containers land next to the things they actually connect to.
containerPadding?numberFallback inner padding for containers that carry no padding of their own.
groupSpacing?numberGap between compound units when a level falls back to the built-in grid.
componentSpacing?numberGap between packed disconnected components. Defaults to nodeSpacing. See component-packing.ts — this applies to EVERY layout, not just the new ones, because "lay out a forest and the trees land on top of each other" is an adapter-agnostic bug.
aspectRatio?numberTarget width/height of the packed result. 1.6 ≈ a landscape screen.
removeOverlaps?booleanPush nodes apart if the algorithm left them overlapping. Default true.
columns?numbergrid: number of columns. Defaults to ceil(sqrt(n)).
rootId?stringtree/radial: the node to root the tree / centre the rings on.
branchDirections?Record<string, FlowDirection>tree: per-branch direction. The subtree rooted at each listed node flows its own way instead of the tree's direction — a mind map is { 'left-branch': 'RL', 'right-branch': 'LR' }.

Was this page helpful?

UnifiedLayoutOptions — Grafloria