Skip to main content

BPMN shapes

The shapes.bpmn2 namespace provides you with a set of Business Process Model and Notation 2.0 shapes.

In this section we will provide markup selectors for all bpmn shapes, so you can style them accordingly.

Elements

Activity

A rectangular Activity shape with icons.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer of all nodes
backgroundSVGRectElementRectangle background of the shape
borderSVGPathElementBorder of the shape (see built-in border styles and border types)
iconSVGImageElementImage containing the icon (see list of available icons)
labelSVGTextElementText inside the shape
markersSVGGElementContainer for marker icons (see list of available markers)
const activity = new shapes.bpmn2.Activity({
attrs: {
background: { fill: '#6764A7' },
icon: { iconType: 'receive' },
label: { text: 'My Activity' },
markers: {
iconTypes: ['ad-hoc', 'loop'],
iconsFlow: 'column',
iconColor: '#ffffff'
}
}
});

Static properties

ACTIVITY_MARKER_ICONS

Static property containing several marker icons that can be used with the Activity shape.

NameImage
noneNo image
parallel
sequential
sub-process
compensation
ad-hoc
loop

Add custom icons by defining them in the shapes.bpmn2.Activity.ACTIVITY_MARKER_ICONS static property.

// define myIcon
shapes.bpmn2.Activity.ACTIVITY_MARKER_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
activity.attr('markers/iconTypes', ['myIcon']);

The marker is triggering 'element:marker:*' paper events.

ACTIVITY_TYPE_ICONS

Static property including Activity type icons that can be used within the shapes.

NameImage
noneNo image
receiveReceive
sendSend
business-ruleBusiness Rule
serviceService
scriptScript
manualManual
userUser

Add custom icons by defining them in the shapes.bpmn2.Activity.ACTIVITY_TYPE_ICONS static property.

// define myIcon
shapes.bpmn2.Activity.ACTIVITY_TYPE_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
activity.attr('icon/iconType', 'myIcon');

Special attributes

borderRadius

Set the border radius of the shape.

activity.attr('border/borderRadius', 20);
borderStyle

Set the style of the border.

NameDescription
solidSolid style border (default)
dashedDashed style border
dottedDotted style border
activity.attr('border/borderStyle', 'dashed');
borderType

Set the border type.

NameDescription
singleSingle line border (default)
thickSingle line border but thicker
doubleDouble line border
activity.attr('border/borderType', 'double');
iconColor

Set the icon or marker icons color.

activity.attr('icon/iconColor', '#6764A7');
activity.attr('markers/iconColor', '#6764A7');
iconsFlow

Set the marker icons flow, available values are:

NameDescription
rowMarker icons will be displayed in a row (default)
columnMarker icons will be displayed in a column
activity.attr('markers/iconsFlow', 'column');
iconSize

Set the markers icon size.

activity.attr('markers/iconSize', 24);
iconsOrigin

Set the marker icons origin:

NameDescription
left-topSets the origin to top left
left-bottomSets the origin to left bottom
right-topSets the origin to right top
right-bottomSets the origin to right bottom
topSets the origin to top middle
bottomSets the origin to bottom middle (default)
rightSets the origin to right middle
leftSets the origin to left middle
centerSets the origin to center
activity.attr('markers/iconsOrigin', 'center');
iconType

Set the main icon. See icon types.

activity.attr('icon/iconType', 'send');
iconTypes

Set the marker icons. See icon types. Attribute has to be an array of strings. Note: an array is required.

// pass 'rewrite' option to replace markers, instead of merging them with existing ones
activity.attr('markers/iconTypes', ['parallel', 'sequential'], { rewrite: true });

Annotation

An annotation shape.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer of all nodes
bodySVGRectElementRectangle body of the shape
borderSVGPathElementBorder of the shape
labelSVGTextElementAnnotation text
const annotation = new shapes.bpmn2.Annotation({
attrs: {
'body': {
stroke: '#fe854f'
},
'label': {
text: 'Group'
}
}
});

Special attributes

annotationD

Change the annotation border length. annotationD is an object with the following properties:

PropertyTypeDescription
sizenumberThickness of annotation border
side'left' | 'top' | 'right' | 'bottom'side on which to render annotation border
annotation.attr('border/annotationD', { size: 30, side: 'bottom' });

Choreography

A choreography shape.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGPathElementRectangular body of the shape
contentHTMLDivElementText content inside of the initiating participant.
participantsSVGGElementThe wrapping groups around participants
participantsBodiesSVGRectElementParticipant rectangular bodies
participantsLabelsSVGTextElementParticipant labels.
initiatingParticipantSVGGElementThe wrapping group around the initiating participant.
initiatingParticipantBodySVGRectElementInitiating participant body.
initiatingParticipantLabelSVGTextElementInitiating participant label.
subProcessSVGPathElementThe sub-process icon.
const choreography = new shapes.bpmn2.Choreography({
attrs: {
body: {
fill: '#ffc2a7',
stroke: '#fe854f'
},
content: {
html: 'Choreography'
},
participantsBodies: {
fill: 'lightblue'
}
},
participants: ['Participant 1', 'Participant 2'],
initiatingParticipant: 1
});

Model attributes

participants

An array of participant names.

const participants: string[] = choreography.get('participants');
choreography.set('participants', ['Participant 1', 'Participant 2']);
participantHeight

The height of a single participant.

const participantHeight: number = choreography.get('participantHeight');
choreography.set('participantHeight', 20);
initiatingParticipant

An index or the name of the initiating participant.

const initiatingParticipant: string | number = choreography.get('initiatingParticipant');
choreography.set('initiatingParticipant', 'Participant 2');

Conversation

A polygon shape with label and markers.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGPolygonElementPolygon body of the shape
markersSVGGElementContainer for marker icons (see list of available markers)
labelSVGTextElementShape text
const conversation = new shapes.bpmn2.Conversation({
attrs: {
'body': {
fill: '#ffc2a7',
stroke: '#fe854f'
},
'label': {
text: 'My Conversation'
}
}
});

Static properties

CONVERSATION_MARKER_ICONS

The CONVERSATION_MARKER_ICONS static property includes icons that can be used within the shape.

noneNo image.
parallel
sequential
sub-process
compensation
ad-hoc
loop

Add custom icons by defining them in the shapes.bpmn2.Conversation.CONVERSATION_MARKER_ICONS static property.

shapes.bpmn2.Conversation.CONVERSATION_MARKER_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
conversation.attr('markers/iconTypes', ['myIcon']);

The marker is triggering 'element:marker:*' paper events.

Special attributes

iconColor

Set the marker icons color.

conversation.attr('markers/iconColor', '#6764A7');
iconSize

Set the marker icons size.

conversation.attr('markers/iconSize', 24);
iconTypes

Set the marker icons. Property has to be an array of strings. Note: an array is required.

// pass 'rewrite' option to replace markers, instead of merging them with existing ones
conversation.attr('markers/iconTypes', ['ad-hoc', 'loop'], { rewrite: true });
iconsFlow

Set the marker icons flow, available values are:

rowMarker icons will be displayed in a row (default)
columnMarker icons will be displayed in a column
conversation.attr('markers/iconsFlow', 'column');
iconsOrigin

Set the marker icons origin, available values are:

left-topSets the origin to top left
left-bottomSets the origin to left bottom
right-topSets the origin to right top
right-bottomSets the origin to right bottom
topSets the origin to top middle
bottomSets the origin to bottom middle (default)
rightSets the origin to right middle
leftSets the origin to left middle
centerSets the origin to center
conversation.attr('markers/iconsOrigin', 'center');

DataObject

A polygon shape with label.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGPathElementPath body of the shape (see body configuration options)
labelSVGTextElementShape text
dataTypeIconSVGImageElementImage containing the icon (see list of available icons)
collectionIconSVGImageElementImage containing the collection icon (see list of available icons)
const dataObject = new shapes.bpmn2.DataObject({
attrs: {
'body': {
fill: '#ffc2a7',
stroke: '#fe854f'
},
'label': {
text: 'Data Store'
}
}
});

Static properties

DATA_OBJECT_COLLECTION_ICONS

The DATA_OBJECT_COLLECTION_ICONS static property includes one icon that can be used within the shape.

falseNo image.
true

Add custom icons by defining them in the shapes.bpmn2.DataObject.DATA_OBJECT_COLLECTION_ICONS static property.

shapes.bpmn2.DataObject.DATA_OBJECT_COLLECTION_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
dataObject.attr('collectionIcon/iconType', 'myIcon');
DATA_OBJECT_TYPE_ICONS

The DATA_OBJECT_TYPE_ICONS static property includes icons that can be used within the shape.

noneNo image.
input
output

Add custom icons by defining them in the shapes.bpmn2.DataObject.DATA_OBJECT_TYPE_ICONS static property.

shapes.bpmn2.DataObject.DATA_OBJECT_TYPE_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
dataObject.attr('dataTypeIcon/iconType', 'myIcon');

Special attributes

collection

Set the collection icon.

dataObject.attr('collectionIcon/collection', 'true');
iconColor

Set the icon or collection icon color.

dataObject.attr('collectionIcon/iconColor', '#6764A7');
dataObject.attr('dataTypeIcon/iconColor', '#6764A7');
iconType

Set the main icon.

dataObject.attr('dataTypeIcon/iconType', 'input');
objectD

Changes the fold of the shape.

dataObject.attr('body/objectD', 30);

DataStore

A polygon shape with label.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGPathElementPath body of the shape
topSVGEllipseElementTop ellipse element
labelSVGTextElementShape text
const dataStore = new shapes.bpmn2.DataStore({
attrs: {
'body': {
fill: '#ffc2a7',
stroke: '#fe854f'
},
'top': {
fill: '#ffc2a7',
stroke: '#fe854f'
},
'label': {
text: 'Data Store'
}
}
});

Methods

topRy()
dataStore.topRy(t?: string | number, opt?: dia.ModelSetOptions): string | number;

If used without parameters, returns the vertical radius of the exposed area of the DataStore base (the value of the body/lateralArea attribute; 10 by default).

If first parameter is not undefined, sets the cylinder DataStore radius of the exposed area of the DataStore base.

If the provided value is a percentage, it is relative to the refBBox.height of the shape. In practice, only values between '0%' and '50%' make sense. If the provided value is a number, it determines the vertical radius directly. Only values between 0 and half of refBBox.height make sense.

The function automatically sets the value of several attributes: body/lateralArea; and top/ry, top/cy, top/refRy and top/refCy. If these arguments need to be modified further, make sure to assign them only after calling cylinder.topRy.

Event

A circular shape with icon and label.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
backgroundSVGEllipseElementEllipse background of the shape
borderSVGPathElementBorder of the shape (see built-in border types)
iconSVGImageElementImage containing the icon (see list of available icons)
labelSVGTextElementShape text
const group = new shapes.bpmn2.Event({
attrs: {
'body': {
stroke: '#fe854f'
},
'label': {
text: 'Group'
}
}
});

Static properties

EVENT_ICONS

The EVENT_ICONS static property includes several icons that can be used within the shape.

noneNo image.
message1
message2
timer1
conditional1
link1
link2
signal1
signal2
error1
error2
escalation1
escalation2
termination1
termination2
compensation1
compensation2
cancel1
cancel2
multiple1
multiple2
parallel1
parallel2

Add custom icons by defining them in the shapes.bpmn2.Event.EVENT_ICONS static property.

shapes.bpmn2.Event.EVENT_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
event.attr('icon/iconType', 'myIcon');

Special attributes

borderStyle

Set the style of the border.

solidSolid style border (default)
dashedDashed style border
dottedDotted style border
event.attr('border/borderStyle', 'dashed');
borderType

Set the border type.

singleSingle line border (default)
thickSingle line border but thicker
doubleDouble line border
event.attr('border/borderType', 'double');
iconColor

Set the icon color.

event.attr('icon/iconColor', '#6764A7');
iconType

Set the icon.

event.attr('icon/iconType', 'message1');

Gateway

A polygon shape with icon.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGPolygonElementPolygon body of the shape
labelSVGTextElementShape text
iconSVGImageElementImage containing the icon (see list of available icons)
const gateway = new shapes.bpmn2.Gateway({
attrs: {
'body': { fill: 'gold', stroke: 'black' },
'icon': { iconType: 'exclusive' },
'label': { text: 'My Activity' }
}
});

Static properties

GATEWAY_ICONS

The GATEWAY_ICONS static property includes several icons that can be used within the shapes.

exclusive_blankNo image.
exclusive
inclusive
parallel
event
exclusive_event
parallel_event
complex

Add custom icons by defining them in the shapes.bpmn2.Gateway.GATEWAY_ICONS static property.

shapes.bpmn2.Gateway.GATEWAY_ICONS['myIcon'] = 'pathToImage'; // or data URI

// later on in the code
gateway.attr('icon/iconType', 'myIcon');

Special attributes

iconColor

Set the icon color.

gateway.attr('icon/iconColor', '#6764A7');
iconType

Set the icon.

gateway.attr('icon/iconType', 'exclusive');

Group

A rectangle shape with label.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGRectElementRectangle body of the shape
wrapperSVGRectElementRectangle wrapper of the shape
labelSVGTextElementShape text
const group = new shapes.bpmn2.Group({
attrs: {
'body': {
stroke: '#fe854f'
},
'label': {
text: 'Group'
}
}
});

HeaderedPool

A rectangle shape with nested lanes and an additional header. Inherits from Pool shape and adds a header rectangle and headerLabel text label.

Additional attrs properties:

SelectorNodeDescription
headerSVGRectElementRectangular header of the shape, positioned to the left of the shape's body
headerLabelSVGTextElementText label inside the header
const headeredPool = new shapes.bpmn2.HeaderedPool();
headeredPool.resize(700, 400);
headeredPool.position(25, 200);
headeredPool.attr('root/magnet', false);
headeredPool.attr('laneHeaders/fill', '#3cb371');
headeredPool.attr('milestoneHeaders/fill', '#00fa9a');
headeredPool.attr('milestoneHeaders/stroke', '#333333');
headeredPool.attr('milestoneLines/stroke', '#3cb371');
headeredPool.attr('milestoneLines/strokeWidth', 2);
headeredPool.attr('milestoneLabels/fill', '#333333');
headeredPool.attr('milestoneLabels/fontStyle', 'italic');
headeredPool.attr('header/fill', '#00fa9a');
headeredPool.attr('headerLabel/text', 'Headered Pool');
headeredPool.attr('headerLabel/fill', '#ffffff');

Pool

A rectangle shape with nested lanes.

Supported attrs properties:

SelectorNodeDescription
rootSVGGElementContainer for all shape nodes
bodySVGRectElementRectangle body of the shape
laneGroupsSVGGElementSelector for all lane groups
laneHeadersSVGRectElementSelector for all lane rect headers
laneLabelsSVGTextElementSelector for all lane text labels
lanesSVGRectElementSelector for all lane rect bodies
milestoneGroupsSVGGElementSelector for all milestone groups
milestoneHeadersSVGRectElementSelector for all milestone rect headers
milestoneLabelsSVGTextElementSelector for all milestone text labels
milestoneLinesSVGLineElementSelector for all milestone lines
const pool = new shapes.bpmn2.Pool({
position: { x: 100, y: 100 },
attrs: {
laneHeaders: {
fill: '#3cb371'
},
milestoneHeaders: {
fill: '#00fa9a',
stroke: '#333333'
},
milestoneLines: {
stroke: '#3cb371',
strokeWidth: 1
},
milestoneLabels: {
fill: '#333333',
fontStyle: 'italic'
}
},
milestonesSize: 30,
milestones: [
{
label: 'milestone',
},
{
label: 'fixed milestone',
size: 200
},
{
label: 'milestone',
}
],
headerSize: 30,
lanes: [
{
label: 'lane',
},
{
label: 'fixed lane',
size: 100
},
{
label: 'lane'
}
]
});

Methods

getLaneBBox()
pool.getLaneBBox(laneGroupId: string): g.Rect | null;

Get the bounding box of a lane group (header + lane) with laneGroupId id.

getLanePath()
pool.getLanePath(laneGroupId: string): string[];

Returns the path to the lane in attributes with laneGroupId id.

const path = pool.getLanePath('customId') + '/label';
pool.prop(path, 'new label', { rewrite: true });
getLanesFromPoint()
pool.getLanesFromPoint(point: dia.Point): string[];

Find lanes from a given point, where point is an object with x and y coordinates in the paper local coordinate system. Returns a sorted array of lane ids (from the most nested lane to the top parent) which bounding box contains the point.

Note: if lane has a custom id assigned, it will be returned instead.

getLanesIds()
pool.getLanesIds()

Returns an array of all lane identifiers (in non-specific order).

getMilestoneBBox()
pool.getMilestoneBBox(milestoneGroupId: string): g.Rect | null;

Get the bounding box of a milestone group (including its header) by milestoneGroupId id.

getMilestoneFromPoint()
pool.getMilestoneFromPoint(point: dia.Point): string | null;

Find a milestone from a given point, where point is an object with x and y coordinates in the paper local coordinate system. Returns a string id of the milestone which bounding box contains point.

Note: if milestone has a custom id assigned, it will be returned instead.

getMinimalSize()
pool.getMinimalSize(): dia.Size;

Return the width and height of the minimal bounding box necessary to encompass all of the shape's content.

getParentLaneId()
pool.getParentLaneId(laneGroupId)

Returns a parent lane id or null if the lane is a top-level lane.

Model attributes

lanes

Lanes in the Pool. Each lane is contained in a group along with the header and has a unique id. Each lane may have optional properties:

PropertyTypeDescription
labelstringText content of the lane's label (when left undefined the header with label will not be shown)
idstringCustom id of the lane group
sizenumberSize of the lane, when defined it will fix the lane height to the specified value
headerSizenumberSize of the lane header
sublanesSublaneNested lanes
pool.set('lanes', [
{
label: 'fixed lane',
size: 80,
headerSize: 40
},
{
label: 'lane with sublanes',
sublanes: [
{
id: 'customLane'
// omit the label property or make it undefined to hide the header
},
{
label: 'sublane 1'
}
]
}
]);
milestones

Milestones in the Pool. Each milestone may have optional properties:

PropertyTypeDescription
labelstringText content of the milestone's label
idstringCustom id of the milestone group
sizenumberSize of the milestone, when defined it will fix the milestone width to the specified value
pool.set('milestones', [
{
label: 'milestone'
},
{
label: 'milestone with fixed width',
id: 'customMilestone',
size: 350,
}
]);
milestonesSize

Height of all milestones

const milestonesSize: number = pool.get('milestonesSize');
pool.set('milestonesSize', 100);
headerSize

Default size of all lane headers

const headerSize: number = pool.get('headerSize');
pool.set('headerSize', 20);
padding

Padding within the Pool's body element, useful when creating another shapes based on Pool.

const padding: dia.Padding = pool.get('padding');
pool.set('padding', 20);
pool.set('padding', { top: 10, right: 20, bottom: 5, left: 10 });

Special attributes

labelAlignment

Aligns the label to the specified side, relatively to the header:

left-topSets the alignment to top left
left-bottomSets the alignment to left bottom
right-topSets the alignment to right top
right-bottomSets the alignment to right bottom
topSets the alignment to top middle
bottomSets the alignment to bottom middle
rightSets the alignment to right middle (default for milestone labels)
leftSets the alignment to left middle
centerSets the alignment to center (default for lane labels)
// align all labels
pool.attr('laneLabels/labelAlignment', 'left');
pool.attr('milestoneLabels/labelAlignment', 'center');

// align individual labels with custom id
pool.attr('label_firstLane/labelAlignment', 'right');
pool.attr('milestoneLabel_firstMilestone/labelAlignment', 'right');
labelMargin

Applies margin around the label. The util.normalizeSides is used to understand the provided value. A single number is applied as padding to all sides of the elements. An object may be provided to specify values for left, top, right, bottom, horizontal and/or vertical sides.

// add margin to all labels
pool.attr('laneLabels/labelMargin', 4);
pool.attr('milestoneLabels/labelMargin', { vertical: 6 });

// control the margin of individual labels with custom id
pool.attr('label_firstLane/labelMargin', 0);
pool.attr('milestoneLabel_firstMilestone/labelMargin', { vertical: 4, horizontal: 20 });

Types

Pool namespace exports several helper types.

Sublane

Interface, which describes lanes of a Pool shape (see lanes).

interface Sublane {
label?: string;
size?: number;
id?: string;
headerSize?: number;
sublanes?: Sublane[];
}
Milestone

Interface, which describes milestones of a Pool shape (see milestones).

interface Milestone {
label?: string;
size?: number;
}

A dashed link.

Supported attrs properties:

SelectorNodeDescription
lineSVGPathElementVisible connection of the link
wrapperSVGPathElementAn invisible, interactable wrapper around the connection used to make clicking on the link easier.
const annotationLink = new shapes.bpmn2.AnnotationLink({});
annotationLink.prop('source', { x: 450, y: 600 });
annotationLink.prop('target', { x: 400, y: 750 });
annotationLink.attr('line/stroke', '#fe854f');

A double lined link.

Supported attrs properties:

SelectorNodeDescription
lineSVGPathElementVisible connection of the link
outlineSVGPathElementOutline of the link
wrapperSVGPathElementAn invisible, interactive wrapper around the connection used to make clicking on the link easier.
const conversationLink = new joint.shapes.bpmn2.ConversationLink({
source: { x: 250, y: 260 },
target: { x: 700, y: 260 },
attrs: {
line: {
stroke: '#30d0c6',
},
outline: {
stroke: '#5654a0'
}
}
});

DataAssociation

A dashed link.

Supported attrs properties:

SelectorNodeDescription
lineSVGPathElementVisible connection of the link
wrapperSVGPathElementAn invisible, interactive wrapper around the connection used to make clicking on the link easier.
const dataAssociation1 = new joint.shapes.bpmn2.DataAssociation({
source: { x: 250, y: 260 },
target: { x: 700, y: 260 },
attrs: {
line: {
stroke: '#30d0c6',
}
}
});

Flow

A link with configurable flow.

Supported attrs properties:

SelectorNodeDescription
lineSVGPathElementVisible connection of the link
wrapperSVGPathElementAn invisible, interactive wrapper around the connection used to make clicking on the link easier.
const flow = new joint.shapes.bpmn2.Flow({
source: { x: 250, y: 340 },
target: { x: 700, y: 340 },
attrs: {
line: {
flowType: 'message'
}
}
});

Special attributes

flowType

The Flow link comes with 4 flow types:

sequenceA simple link with no additional elements
defaultAdds crossed line at the source of the link
conditionalAdds a rhombus at the source of the link
messageDashed link with circle at the source of the link
flow.attr('line/flowType', 'message');
markerFill

Flow link accepts additional attribute for styling the fill of the markers.

Note: markerFill applies only to message and conditional flowTypes.

flow.attr('line/markerFill', '#fe854f');