Skip to main content
Version: 4.3

SelectionApi

Imperative handle returned by useSelection for reading and driving the current selection. Requires a <Diagram> ancestor.

collection is the stable mvc collection provided by <Diagram>: always present and identity-stable across renders. selection stays null until a Selection feature has mounted on the resolved paper.

Properties​

collection​

readonly collection: Collection<Cell<Attributes<Selectors>, ModelSetOptions>>;

Stable mvc collection of the selected cells, provided by <Diagram>.


selectAllElements​

readonly selectAllElements: () => void;

Select every element in the graph (links excluded).

Returns​

void


selectCells​

readonly selectCells: SelectCells;

Programmatically replace the selection. See SelectCells.


selection​

readonly selection: Selection<Collection<any>> | null;

The underlying ui.Selection view, or null until <Selection> mounts.


startSelectionRegion​

readonly startSelectionRegion: (options?) => Promise<Cell<Attributes<Selectors>, ModelSetOptions>[] | null>;

Start a rubber-band region gesture and resolve to the cells it enclosed, or null if the gesture was cancelled or no <Selection> has mounted yet. Configure the gesture per call with StartSelectionRegionOptions.

Parameters​

ParameterType
options?StartSelectionRegionOptions

Returns​

Promise<Cell<Attributes<Selectors>, ModelSetOptions>[] | null>

Stay in the know

Be where thousands of diagramming enthusiasts meet

Star us on GitHub