Click, brush, and lasso selection

Configure click selection for nodes and edges and area selection for nodes

Click to select · Brush select · Lasso select

Choose a selection gesture

GestureConfiguration
Click a node or edgeclick-select. Enable multiple and hold the trigger key to add to the selection
Draw a rectangle around nodesbrush-select, with key setting the modifier
Draw a freehand outline around nodeslasso-select, with key setting the modifier

Configuration and example

Click to select, Shift-click to add to the selection, or drag from empty space to select a rectangle. Set selected node colors in node.stateStyles.selected.

Loading example…
Drag empty space to brush; Shift-click to add; drag a selected node to move the selection; click empty space to clear
const behaviors = [
  { type: 'zoom-canvas', minZoom: 0.5, maxZoom: 2 },
  'drag-node',
  { type: 'click-select', multiple: true, trigger: 'shift' },
  { type: 'brush-select', key: null },
] satisfies Array<BehaviorName | BuiltInBehaviorConfig>;

When enabling pan, brush, and lasso together, give them distinct gestures. Try the selection example. To update an application panel after selection, listen for selection events.