Skip to main content

<DiagramPaletteComponent/>

A shape palette for linking with a DiagramComponent. This component will automatically display the shapes available to the Diagram it is attached to, allowing your users to drag them onto your Diagram, or to click to add.

Usage​

You need to declare a DiagramProvider as the parent of your DiagramComponent and DiagramPalette:

<script>
export default {
data:() => {
data:{ ... },
options:{ ... }
}
}
</script>
<template>
<DiagramProvider>
<DiagramComponent :options="options" :data="data"/>
<DiagramPalette/>
</DiagramProvider>
</template>

Props​

DiagramPaletteProps
NameTypeDescription
allowClickToAdd?booleanWhen in tap mode, allow addition of new vertices simply by clicking, instead of requiring a shape be drawn. (When this is true, the drawing method also still works)
allowDropOnEdge?booleanWhether or not to allow drop on edge. Defaults to false.
allowRotation?booleanWhether or not to allow rotation of elements being dragged. Defaults to true.
autoEdgeConnect?boolean | AutoEdgeConnectOptionsIf true, the palette will automatically connect a new vertex being dragged onto the canvas to existing vertices, if the shape definitions for the new vertex and/or the existing vertices have source/target elements.
autoExitDrawMode?booleanDefaults to true: when in 'tap' mode and a new group/node has been drawn on the canvas, the UI is set back to pan mode.
className?stringOptional class name to set on the diagram palette root element.
diagram?DiagramOptional diagram to attach to. In most cases it is better to use a DiagramProvider to provision the diagram to this component.
dragSize?SizeOptional size to use for dragged elements.
fill?stringOptional fill color to use for new elements. This should be in RGB format, not a color like 'white' or 'cyan' etc.
iconSize?SizeOptional size to use for icons. Defaults to 150x100 pixels. If you provide this but not dragSize this size will also be used for an icon that is being dragged.
inspector?booleanWhen true, selecting an element in the canvas will cause its related shape to be selected in the palette. Defaults to true.
mode?PaletteModeMode to operate in - 'drag' or 'tap'. Defaults to 'drag' (PALETTE_MODE_DRAG).
onCellAdded?(dc:DiagramCell) => anyCallback to invoke when a new diagram cell has been added.
outline?stringOptional color to use for outline of dragged elements. Should be in RGB format.
paletteStrokeWidth?numberStroke width to use for shapes in palette. Defaults to 1.
preparedShapes?Array<PreparedShape>Optional set of prepared shapes to show in the palette. When this is provided, the palette will only render these shapes, and not the contents of the shape library.
rotationSpeed?numberThe number of milliseconds required to complete a full rotation of an element when the trigger key is held down. Defaults to 2000.
selectAfterAdd?booleanWhen true (which is the default), a newly dropped shape will be set as the underlying model's selection.
showAllMessage?stringMessage to use for the 'show all' option in the shape set drop down when there is more than one set of shapes. Defaults to Show all.
showGroups?booleanWhether or not to show groups in the palette. Defaults to true.
showLabels?booleanOptionally show each shape icon's label underneath it
updateTypeOnPaletteTap?booleanWhen true, clicking on an entry in the palette will change the type of any selected vertices to that type. Defaults to false.
This is a potentially destructive operation if the properties of the new shape type are not compatible with the old one.