layout.applyByName
applyByName(name: string, nodeIds?: string[], options?: unknown): Promise<void>Apply a layout by registered name.
Built-in names ("circle", "grid", "line", "spiral", "sphere",
"cube", "scatter", "ego") route to the typed methods; the shortcuts
"scale-spacing-up" / "scale-spacing-down" scale current positions.
Any other name is looked up in the engine's layout registry, so layouts
added with register are applied the same way — recorded in undo
history, animated by the tween, and bracketed by "layout:start" /
"layout:end".
name | string | A built-in name, a shortcut, or a registered pack:name. |
nodeIds | string[] | Optional subset of node IDs to lay out. |
options | unknown | Passed to registered layouts as-is. Ignored by the built-in names and shortcuts, which use their defaults (call the typed method to pass options to those). |
Returns: Promise<void>
Example
await api.layout.applyByName("sphere");
await api.layout.applyByName("acme:rack", ids, { rows: 4 });