# Flux 2.0 — Flow diagram
Steps and the connections between them on a pannable canvas, for automations and process maps.
Reference: https://flux.kaptio.com/components/flow/
Requires: https://flux.kaptio.com/tokens/v2/flux.css and flux-components.css
## Use it when
Shows how steps connect: a trigger, the conditions it passes through and the actions at the end. Nodes are buttons laid out on a grid of flow units, edges are curves with arrowheads in one SVG, and branch labels sit on their edges. Selecting a node highlights the edges that touch it. The canvas scrolls inside its frame, and a minimap shows where the viewport sits.
## Do not use it when
Not for a strictly linear sequence; use the Stepper or the Timeline. Not for an organisation chart or a hierarchy; use a tree or nested list. Not for editing a diagram freely; that needs a canvas library, which this component styles but does not replace.
## Markup
### Automation
YesNo
## API
- flux-flow (class): The frame. data-flux-flow handles selection, the edge highlight and the minimap.
- flux-flow__viewport (class): The scroll container. Give it role="region", a name and tabindex="0".
- flux-flow__canvas (class): Sized by inline --flux-cols and --flux-rows in flow units.
- flux-flow__edges | __edge | __arrow (class): The SVG, with viewBox="0 0 cols rows", its paths and arrowhead markers. data-from and data-to name the nodes an edge joins.
- flux-flow__label (class): An edge label, positioned with unitless --flux-x and --flux-y.
- flux-flow__nodes | __node | __node-type | __node-title (class): The ordered list of node buttons, each with data-node, aria-pressed and inline unitless --flux-x, --flux-y, --flux-w and --flux-h.
- flux-flow__minimap | __minimap-node | __minimap-viewport (class): The overview, drawn in the same units.
- flux-flow-select (attribute): Event dispatched on the frame when the selection changes. detail.node is the button, or null.
## Accessibility
- Edges are invisible to a screen reader, so each node carries hidden text naming what comes next: “Yes: Send final documents. No: Until 30 days before departure.” Write node titles so they read on their own after a branch label.
- List nodes in the order the process runs, not the order they were drawn.
- The minimap is hidden from assistive technology; the viewport scrolls with the keyboard.
- Selected state is a border and a ground change, and aria-pressed says it too.
## Keyboard
- Tab: Moves through the nodes in list order, which is the order of the process.
- Enter / Space: Selects the node, or clears the selection if it was selected.
- Arrow keys: Scroll the canvas when the viewport has focus.
## Tokens
- --flux-flow-unit | -height | -bg | -border | -grid
- --flux-flow-node-bg | -node-border | -node-padding | -node-type
- --flux-flow-node-selected-bg | -node-selected-border
- --flux-flow-edge | -edge-active | -edge-width | -label-bg
- --flux-flow-minimap-width | -minimap-bg | -minimap-node | -minimap-viewport
## Do
- Lay the flow out left to right, branching up and down.
- Label every branch out of a condition.
## Do not
- Do not colour nodes by type; the type label says it. Colour is for the selection.
- Do not cross edges when moving a node would avoid it.