Skip to main content
Version: 4.3

InteractionsOptions

Options for the <Diagram> interactions, which are enabled by default. Every feature flag defaults to true: set it to false to opt out of that block of behaviour (typically when you want to wire it yourself).

Pass these to <Diagram interactions={...}>. They apply uniformly to every <Paper> inside that <Diagram>.

Propertiesโ€‹

clipboard?โ€‹

readonly optional clipboard?: boolean;

Clipboard keyboard shortcuts (Ctrl/Cmd + C / X / V). Requires both <Diagram clipboard> and an active selection.

Defaultโ€‹

true

commandManager?โ€‹

readonly optional commandManager?: boolean;

Undo / redo keyboard shortcuts (Ctrl/Cmd + Z, Shift+Ctrl/Cmd + Z). Requires <Diagram history>.

Defaultโ€‹

true

keyboard?โ€‹

readonly optional keyboard?: boolean;

Master switch for keyboard shortcuts. When false, no keyboard bindings are created regardless of the selection / clipboard / commandManager flags.

Defaultโ€‹

true

paperScroller?โ€‹

readonly optional paperScroller?: boolean;

Master switch for PaperScroller-driven interactions: wheel (zoom/pan), pinch zoom, blank-drag pan, and cursor feedback. When false, none of those are wired even if a PaperScroller feature is detected.

Defaultโ€‹

true

selection?โ€‹

readonly optional selection?: boolean;

Master switch for selection interactions: click-to-select, Ctrl/Cmd + click toggle, the Shift+drag region, and the Delete/Backspace, Escape, and Ctrl/Cmd + A keyboard shortcuts. When false, none of those are wired (including the region) even if a Selection feature is detected. No-op when no Selection feature is present.

Use InteractionsOptions.selectionRegion to configure or disable the Shift+drag region on its own.

Defaultโ€‹

true

selectionRegion?โ€‹

readonly optional selectionRegion?: 
| boolean
| StartSelectionRegionOptions
| SelectionRegionCallback;

Shift+drag rubber-band region behaviour. Refines the region drawn when selection is enabled, a no-op when selection is false (the same way InteractionsOptions.wheelAction is a no-op when paperScroller is false).

  • true / omitted: enabled with a rectangular region.
  • a StartSelectionRegionOptions object: enabled and configured. Region-shape props sit at the top level next to type (e.g. { type: 'range', vertical: true }); selectLinks, live, strict, filter apply to every kind, and options is a raw escape hatch. Drawn via the same startSelectionRegion() API as useSelection().
  • a SelectionRegionCallback function: enabled, with the region decided per gesture from the triggering event/state, e.g. ({ event }) => ({ type: event.ctrlKey ? 'range' : 'rectangular' }).
  • false: disables only the region; click-to-select and Ctrl/Cmd + A stay active.

For the object / function forms, pass a stable reference (hoist or memoize) to avoid re-wiring the listeners on every render.

Defaultโ€‹

true

wheelAction?โ€‹

readonly optional wheelAction?: false | "zoom" | "pan";

Mouse-wheel behaviour over the paper.

  • 'pan': scroll pans the paper.
  • 'zoom': scroll zooms around the cursor.
  • false: disables wheel handling. Pinch still zooms.

No-op when paperScroller is false.

Defaultโ€‹

'pan'