Skip to main content

Interface: DiagramCanvasProps

Props of DiagramCanvas.

Properties​

ariaLabel?​

ariaLabel?: string;

Default 'Entity-relationship diagram'.


children?​

children?: ReactNode;

Overlays (toolbars, chips) rendered inside the canvas root, after the React Flow pane.


className?​

className?: string;

Class of the canvas root element.


colorMode?​

colorMode?: ColorMode;

Default 'light'.


decorations?​

decorations?: Decorations | null;

Search hits, paths, diff tones (docs/design/phase3-v1.md §4.2). Never moves the viewport.


detailLevel?​

detailLevel?: DetailLevel;

Default layout.settings.detailLevel ?? 'all'.


displayModel?​

displayModel?: DiagramModel | null;

Model drawn (and laid out) instead of the view-filtered model, such as a diff's merged model. Positions still come from layout; nodes only in this model are placed by the sync layout and never reported through onLayoutChange.


draggable?​

draggable?: boolean;

Read-only mode only: nodes can be dragged locally. Default true (as DbmlViewer today).


edgeStyle?​

edgeStyle?: EdgeStyle;

Default layout.settings.theme.edgeStyle ?? 'orthogonal'.


editable?​

editable?: boolean;

Editable mode: drags, auto-placement and settings are reported through onLayoutChange, groups are draggable by their header, multi-select is on, the side card is off by default. Default false (read-only viewer behaviour: drags are local and forgotten).


focus?​

focus?: CanvasFocus | null;

Focus mode: only the tables within hops refs of ids (+ the notes of the view) are shown, at their usual positions; the viewport fits them when the focus changes. Not stored.


highlightedNodeId?​

highlightedNodeId?: string | null;

Node drawn with the highlight ring and its refs lit (cursor-in-block in the editor).


highlightIds?​

highlightIds?: readonly string[] | null;

Several ids lit like highlightedNodeId (tables, notes, groups, refs).


initialViewport?​

initialViewport?: Viewport | null;

Viewport for the first view of this resetKey instead of the computed one (a restored editor session). Read when the document's first layout is drawn; later changes are ignored.


layout​

layout: Layout | null;

Controlled layout. The canvas never keeps positions of its own once a change is reported.


minimap?​

minimap?: boolean | "auto";

Default 'auto': shown for 8 or more tables in canvases at least 600px wide.


model​

model: DiagramModel | null;

Full model (not view-filtered); null shows nothing (the app shows its own empty state).


onEdgeClick?​

onEdgeClick?: (e) => void;

Called when a ref is clicked.

Parameters​

e​

CanvasEdgeEvent

Returns​

void


onEdgeContextMenu?​

onEdgeContextMenu?: (e) => void;

When set, the canvas calls preventDefault on the native contextmenu event.

Parameters​

e​

CanvasEdgeEvent

Returns​

void


onLayoutChange?​

onLayoutChange?: (next, change) => void;

Called with the complete next layout (immutable update) and what changed.

Parameters​

next​

Layout

change​

LayoutChange

Returns​

void


onLayoutStatus?​

onLayoutStatus?: (status) => void;

'pending' while the ELK result is outstanding, then 'done' (mirrors data-rv-layout). Reported again whenever resetKey changes, even when the value stayed the same.

Parameters​

status​

"pending" | "done"

Returns​

void


onNodeClick?​

onNodeClick?: (e) => void;

Called when a table, note or group is clicked (or activated with the keyboard).

Parameters​

e​

CanvasNodeEvent

Returns​

void


onNodeContextMenu?​

onNodeContextMenu?: (e) => void;

When set, the canvas calls preventDefault on the native contextmenu event.

Parameters​

e​

CanvasNodeEvent

Returns​

void


onNodeDoubleClick?​

onNodeDoubleClick?: (e) => void;

Called when a table, note or group is double-clicked.

Parameters​

e​

CanvasNodeEvent

Returns​

void


onPaneClick?​

onPaneClick?: () => void;

Called when the empty canvas is clicked.

Returns​

void


onPaneContextMenu?​

onPaneContextMenu?: (e) => void;

When set, the canvas calls preventDefault on the native contextmenu event.

Parameters​

e​

CanvasPaneEvent

Returns​

void


onPaneDoubleClick?​

onPaneDoubleClick?: (e) => void;

Called when the empty canvas is double-clicked, with the diagram point.

Parameters​

e​

CanvasPaneEvent

Returns​

void


onUnknownView?​

onUnknownView?: (name) => void;

Called with the name when view names no DiagramView of the model.

Parameters​

name​

string

Returns​

void


onViewportChange?​

onViewportChange?: (viewport) => void;

Called when a pan or zoom ends (user or programmatic) with the viewport it ended at.

Parameters​

viewport​

Viewport

Returns​

void


padding?​

padding?: Partial<Record<"left" | "right" | "top" | "bottom", number>>;

Padding the initial view and Fit keep free for overlays (px). Default DbmlViewer's PAD.


ref?​

ref?: Ref<DiagramCanvasHandle>;

The imperative handle (forwardRef, so it works with React 18 and 19).


resetKey?​

resetKey?: string;

Identity of the document. The initial view (fit / saved viewport) is applied on mount, when this changes, and when view changes — never because model or layout changed.


resizable?​

resizable?: CanvasResizable;

Notes (and, with 'all', tables) get resize handles in editable mode. Default 'notes'.


sideCard?​

sideCard?: boolean;

Table details card on click. Default !editable.


style?​

style?: CSSProperties;

Inline style of the canvas root element.


view?​

view?: string;

DiagramView name; default '' (all). Unknown names render '' and call onUnknownView.


workerUrl?​

workerUrl?: string | URL;

ELK worker script (elkjs/lib/elk-worker.min.js); without it ELK runs in-process.