Skip to main content

Interface: DbmlViewerProps

Props of DbmlViewer.

Properties​

anchor?​

anchor?: string;

The diagram's anchor on the page (docs). Enables the toolbar's 'link' button, which copies location with #<anchor>&<target>.


className?​

className?: string;

Class of the viewer root element.


colorMode?​

colorMode?: ColorMode;

Light or dark palette. Default light.


decorations?​

decorations?: Decorations | null;

Host decorations (§4.2), drawn under search and path decorations.


detailLevel?​

detailLevel?: DetailLevel;

Overrides layout.settings.detailLevel (the toolbar's Detail menu can still change it).


diffAgainst?​

diffAgainst?: CompileInput | null;

Schema diff mode: the source is compared against this older version. The diagram shows both (removed tables, columns and refs too) with added / removed / changed tones and a legend; the editor link is hidden.


draggable?​

draggable?: boolean;

Nodes can be dragged (positions are not persisted). Default true.


edgeStyle?​

edgeStyle?: EdgeStyle;

Overrides layout.settings.theme.edgeStyle. Default orthogonal.


editorUrl?​

editorUrl?: string;

Base URL of the editor for "open in editor" (the DBML goes into #dbml=).


height?​

height?: string | number;

Height of the viewer (number = px). Default 480.


layout?​

layout?: Layout | null;

Parsed layout file; saved positions of the active view are honoured.


minimap?​

minimap?: boolean | "auto";

Show the minimap. Default 'auto': shown whenever part of the diagram is off-screen, and always for diagrams of 8 or more tables in viewers at least 600px wide (smaller below that).


onDiagnostics?​

onDiagnostics?: (diagnostics) => void;

Called with the compile diagnostics whenever the source is compiled.

Parameters​

diagnostics​

Diagnostic[]

Returns​

void


onLinkCopy?​

onLinkCopy?: (href, target) => void;

Called after the 'link' button copied a link.

Parameters​

href​

string

target​

DiagramTarget

Returns​

void


onTargetChange?​

onTargetChange?: (target) => void;

The state as a target, 300 ms after it settles: view, table, focus, detail, search, path, viewport. Not called for the first view.

Parameters​

target​

DiagramTarget

Returns​

void


source​

source: CompileInput;

DBML source, or { files, entry } for a multi-file project.


ssrLayout?​

ssrLayout?: Layout | null;

Positions computed at build time (docs SSR): used for nodes layout has no position for, so no layout engine runs in the browser. Never put into "Open in editor" links.


style?​

style?: CSSProperties;

Inline style of the viewer root element.


target?​

target?: DiagramTarget | null;

What to show (a deep link, docs/design/phase3-v1.md §4.5): view, table (centred and lit; with hops, focus mode), detail level, viewport, search, path. Applied once the first layout is done, and again whenever it changes (a target equal to the last one reported through onTargetChange is not re-applied).


title?​

title?: string;

Title shown above the diagram, also used as the accessible name and export file name.


toolbar?​

toolbar?: ToolbarItem[];

Toolbar buttons, in order. Default: every button (DEFAULT_TOOLBAR).


view?​

view?: string;

DiagramView name; default all tables.


workerUrl?​

workerUrl?: string | URL;

URL of elkjs/lib/elk-worker.min.js; when set (and Worker exists) auto-layout runs in a Web Worker. Without it ELK runs in-process.