Skip to main content
ShapeType
Defines a shape type. If you wish to supply custom shape types you should extend this interface.
NameTypeDescription
collapsedSize?SizeSize for this shape when it is collapsed - only relevant when objectType is Group.
collapsedTemplate?stringTemplate representing the shape when it is collapsed - only relevant when objectType is Group
defaultTarget?booleanDefaults to true, meaning this will by default be treated as an edge target for drag/drop edges. In some cases you may not want the entire shape to be a target, for instance if its connectivity is to various ports (as an example, consider a logic gate with input pins and an output pin).
description?stringCan be shown in a palette to give a user more information about a shape
font?FontSpecOptional shape-specific settings for font. This will override library wide font settings.
group?stringOptional name of the group to which the shape belongs. This is not the same concept as a "group" inside the data model: this is a grouping of shape types, used to organise them in the UI.
icon?stringOptional icon to use in the shape palette instead of rendering the template.
initialSize?SizeInitial size for this specific shape. If not provided defaults will be used.
label?stringLabel to use for the shape type when displayed in a palette
labelPadding?numberOptional label padding when labels are top/bottom to use for this shape type. The shape library will default to any labelPadding set on the shape set, or the system default.
labelPosition?LabelPositionWhere to place the label for this type. Most shapes default to center but sometimes you might want to specify where a particular shape's label should be.
locked?booleanFor groups, indicates that the group is locked and no edits can occur to the child vertices. This is intended for use with the members option, for groups that gather a set of elements together to form a more complex building block. As an example in the real world, consider a Binary Adder: it is a group of logic gates whose relationships are fixed.
members?GroupTemplateOptional blueprint for child vertices and edges to be created when this group is added. Only relevant when objectType is Group.
mergeProperties?booleanIf true, instructs the inspector to merge this ShapeType's properties onto any defined by its ShapeSet.
objectType?stringDefaults to Node.objectType. Indicates the object type - Node or Group - to create in the UI when a shape of this type is dragged.
payload?ObjectDataOptional initial payload to set on model objects that are dragged from a palette onto the canvas.
previewData?ObjectDataOptional data to use when showing a preview of this shape - some shapes, such as Labels, will not display anything unless provided with a dataset. This config lets you provide the data that will be used when rendering a preview of the shape, for instance in a palette, or when drawing via the vertex drawing plugin.
properties?Array<ShapePropertyDefinition>A list of configurable properties exposed by this shape's template. An inspector can read this array to automatically generate an editing UI.
templatestringTemplate representing the shape
typestringThe shape's type.