Foblex Flow
Introduction
Overview
Nodes
Custom Nodes
Drag Handle
Node Selection
Resize Handle
Rotate Handle
Grouping
Drag to Group
Connectors
Node as Connector
Connector Inside Node
Connector Outlet
Limiting Connections
Connection Rules
Connectable Side
Updated
Connections
Drag to Connect
Drag to Reassign
Create Node on Connection Drop
Remove Connection on Drop
Assign Node to Connection on Drop
Auto Snap
Connection Types (Straight, Segment, Bezier, Adaptive Curve)
Custom Connection Type
Connection Behaviours
Connection Markers
Connection Content
Updated
Connection Waypoints
New
Connection Gradients
Updated
Connection Connectable Side
New
Extensions
Auto Pan
New
Add Node from Palette
Selection Area
Help in Positioning (Legacy)
Deprecated
Magnetic Lines
New
Magnetic Rects
New
Grid System
Minimap
Zoom
Background
Plugins
Dagre Layout
New
Dagre Auto Layout
New
ELK.js Layout
New
ELK.js Auto Layout
New
Advanced
Large Scene Performance
Connection Redraw Performance
Updated
Cut/Copy/Paste
Undo/Redo
Undo/Redo V2
Drag Start/End Events
Custom Event Triggers
Reference Apps
AI Low-Code Platform
Updated
Schema Designer
Updated
Call Center Flow
Updated
UML Diagram
Updated
Tournament Bracket
Updated
Foblex Flow

Dagre Layout

This page shows how to use @foblex/flow-dagre-layout to calculate a manual graph layout with Dagre and then render the result with Foblex Flow.

The important split is:

  • @foblex/flow-dagre-layout calculates positions
  • @foblex/flow renders nodes, connections, zoom, drag, and viewport behavior
  • your app remains the owner of graph state

Example

[example.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/dagre-layout/example.html [example.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/dagre-layout/example.ts [example.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/dagre-layout/example.scss [apply-layout.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/apply-layout.ts [generate-graph.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/generate-graph.ts [layout-connection-sides.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/layout-connection-sides.ts [layout-controls.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/libs/f-examples/plugins/utils/layout-controls.ts

Install

If your project already includes a custom Flow theme, you can keep schematic installation but skip style injection:

For Nx workspaces:

ng add checks @foblex/flow and the required Foblex companion packages, adds only the missing ones, and wires the default Flow theme into application styles when it is missing.

If you prefer manual installation:

You do not need to install the underlying dagre package separately because the adapter ships it as a runtime dependency.

Minimal Usage

calculate(...) returns only calculated node positions. In a real app you merge them back into your own node model by id.

How To Work With It

  1. Build your own graph state in the shape your app needs.
  2. Convert that graph to IFLayoutNode[] and IFLayoutConnection[].
  3. Call calculate(...) on DagreLayoutEngine.
  4. Merge returned positions back into your state.
  5. Render the updated nodes in f-flow.

Options You Will Usually Change

  • direction: graph direction via EFLayoutDirection
  • algorithm: Dagre ranker via EDagreLayoutAlgorithm
  • nodeGap: spacing between nodes on the same level
  • layerGap: spacing between levels
  • defaultNodeSize: fallback size when a node does not provide size

What This Example Shows

  • Switching layout direction reactively
  • Switching Dagre algorithms reactively
  • Rebuilding the example graph from one graph factory
  • Adding nodes and recalculating the layout
  • Fitting the viewport after each render

When to use it

Use Dagre when your diagram has a mostly hierarchical structure and you want a predictable directed layout for org charts, dependency graphs, or workflow trees.

Related docs and examples

Edit this page on GitHub