Selection in Foblex Flow is the core UX mechanism for working with a diagram: it tells the user what is currently active and enables batch actions.
Selection covers:
You can select by click, toggle items in multi-select mode, drag a selection rectangle, or manage selection via FFlowComponent APIs.
Use the selection system whenever users need to inspect, move, or edit more than one item.
Common scenarios:
Escape clears selection, Ctrl/Meta + A selects all, Delete removes items (in your app state).Selection is also a UX contract: the library adds .f-selected, but you decide how it looks.
Internally, selection lives in the draggable interaction context (selectedItems) and is updated by two primary paths:
SelectByPointerSelectionAreaHandlerAfter the selection logic is finalized, EmitSelectionChangeEvent emits FSelectionChangeEvent only when the selection actually changed.
This keeps handlers predictable and avoids unnecessary re-renders.
fMultiSelectTrigger: FEventTrigger; on f-flow[fDraggable]
Enables toggle multi-select mode.
fTrigger: FEventTrigger; on f-selection-area
Controls when box selection starts (default: event.shiftKey).
Recommended UX defaults: Shift for box selection, Ctrl/Meta for toggle multi-select.
fSelectionChange: EventEmitter<FSelectionChangeEvent>; on f-flow[fDraggable].FSelectionChangeEvent fields:
nodeIds, groupIds, connectionIdsfNodeIds, fGroupIds, fConnectionIds
groupIdsare derived automatically from selected nodes.
FFlowComponentUse these methods when selection is driven by external UI (toolbars, side panels, shortcuts):
getSelection(): ICurrentSelectionselectAll(): voidselect(nodesAndGroups: string[], connections: string[], isSelectedChanged: boolean = true): voidclearSelection(): void.f-selected is applied to selected nodes/groups/connections..f-selection-area is the selection rectangle host class.select(...) requires valid existing ids; unknown ids are ignored.fMultiSelectTrigger..f-selected styling is too subtle, users won’t understand current selection state.Listen to selection changes and show selected item ids in a side panel.
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/node-selection/node-selection.component.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/node-selection/node-selection.component.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/node-selection/node-selection.component.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss
Select multiple items by dragging a rectangle around them. By default, the trigger is Shift + pointer down, but you can customize it with the fTrigger input.
[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/extensions/selection-area/selection-area.component.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/extensions/selection-area/selection-area.component.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/extensions/selection-area/selection-area.component.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss