Skip to main content

<DiagramComponent/>

Provides an SVG diagram component. This is a wrapper around a Surface or Paper, with a few flags set:

  • We use an SVG container element
  • Every cell is drawn as an SVG element from a ShapeLibrary
  • Cell sizes and positions are stored inside the model

A Diagram is a pure SVG UI.

Usage​

<script lang="ts">
import {DiagramComponent, DiagramComponentOptions} from "@visuallyjs/browser-ui-svelte"
import {FLOWCHART_SHAPES} from "@visuallyjs/browser-ui";

const options: DiagramComponentOptions = {
shapes: {
sets: {FLOWCHART_SHAPES}
}
}
const data = {
...
}
</script>
<DiagramComponent options={options} data={data}/>

Props​

DiagramComponentProps
NameTypeDescription
className?stringOptional class name to set on the diagram component's container
data?anyOptional data to load after the component has been mounted.
modelOptions?ModelOptionsOptions for the model used by the diagram. Only required for
certain advanced use cases.
options?DiagramOptionsOptions for the diagram.
url?stringOptional url from which to load data after the component has been mounted. If you provide this and also data, this will take precedence.