Skip to main content

CSS

The various components and plugins in JsPlumb offer a rich set of CSS classes and attributes that you can use to customize your UI. The jsplumbtoolkit.css stylesheet inside the /css directory of the @jsplumbtoolkit/browser-ui package contains sane defaults for all of the classes listed on this page.

info

If you are new to JsPlumb, we strongly recommend including jsplumbtoolkit.css in your page, because there are certain structural styles declared in it. The stylesheet is internally documented and it's easy to edit it to create a cut-down version that works for you.

UI Core

Nodes, groups and ports

Classes assigned to nodes and groups in your UI.

ClassDescription
jtk-connectedAssigned to node/group/port element when the vertex it represents has one or more edges attached.
jtk-default-nodeAssigned by the surface to a node rendered as a default when no component/template mapping was provided.
jtk-groupAssigned by the Surface to a DOM element that represents a group.
jtk-group-collapsedAssigned to a group element when the group is collapsed.
jtk-group-expandedAssigned to a group element when the group is not collapsed.
jtk-nodeAssigned by the Surface to a DOM element that represents a node.
jtk-portAssigned by the Surface to a DOM element that represents a port.

Edges

Classes assigned to edges in your UI

ClassDescription
jtk-connectorAssigned to the SVG element that is the parent of the path element used to draw an edge. A common setup using this class is to assign it a z-index which is lower than the z-index set for .jtk-node and .jtk-group. You can target the path element directly using .jtk-connector path, for instance for setting a stroke-width or stroke
jtk-connector-outlineAssigned to the SVG path element used to draw an edge's outline.
jtk-label-overlayAssigned to all label overlay elements
jtk-overlayAssigned to all overlay elements
jtk-surface-selected-connectionAssigned by the Surface to a DOM element representing an edge in the Toolkit's current selection.

Element dragging

Classes used during the lifecycle of dragging an element (node / group)

ClassDescription
jtk-vertex-drag-original-groupAssigned to a group element when one of its children is being dragged. This can be useful to help manage z-index: we recommend using this class to set a z-index for the drag parent group above that of the other groups, which will ensure that the element you are dragging will appear on top of other groups.
jtk-most-recently-draggedAssigned by the Surface to the vertex element(s) that was/were the most recently dragged elements.
jtk-surface-element-draggingAssigned by the Surface to a vertex element that is being dragged
jtk-vertex-drag-activeAssigned to a group element that is a candidate drop target for a node or group that is currently being dragged
jtk-vertex-drag-hoverAssigned to a group element that is the current drop target for a node or group that is being dragged

Surface

Classes assigned by the Surface component

ClassDescription
jtk-drag-select-defeatAssigned by the Surface to the document body while the user is dragging a vertex or edge. See jsplumbtoolkit.css for the specific rules.
jtk-shapeThis class is assigned to the parent SVG elements for shapes.
jtk-shape-labelThis class is assigned to svg text elements serving as shape labels.
jtk-surfaceAssigned to the DOM element a surface is rendered to.
jtk-surface-canvasAssigned to the canvas element used by a Surface - the DOM element that is the parent of all vertices and edges.
jtk-surface-direct-renderAssigned to the DOM element a surface is rendered to when direct rendering is switched on.
jtk-surface-edge-draggingAssigned by the Surface to the DOM element representing an edge that is currently being dragged
jtk-surface-nopanAssigned to the Surface's DOM element when panning is disabled.
jtk-surface-panningAssigned by the Surface to its canvas while the canvas is being panned (either programmatically or via pointer/touch)
jtk-surface-pointer-deviceAssigned to the Surface's DOM element when JsPlumb detects the device supports pointer events.
jtk-surface-selected-elementAssigned by the Surface to a DOM element representing a vertex in the Toolkit's current selection.
jtk-surface-touch-deviceAssigned to the Surface's DOM element when JsPlumb detects the device supports touch events.

Edge path editors

Classes used by the edge path editors.

ClassDescription
jtk-anchor-candidateAdded to the elements drawn to show where a certain anchor may be relocated to (only applicable for dynamic anchors)
jtk-anchor-placeholderAdded to the element placed at the location of an anchor for a connection that is being edited. This applies to both dynamic and continuous anchors
jtk-bezier-guidelineCSS class assigned to the guidelines linking the anchor points with the control point markers in the bezier edge editor.
jtk-bezier-handleCSS class added to all handles used by the bezier edge editor.
jtk-bezier-handle-control-pointCSS class assigned to a control point handle in the bezier edge editor
jtk-bezier-handle-control-point-1CSS class assigned to the first control point handle in the bezier edge editor
jtk-bezier-handle-control-point-2CSS class assigned to the second control point handle in the bezier edge editor
jtk-edge-deleteAssigned to the optional delete button overlay that the edge path editor can add
jtk-edge-handleClass applied to edge drag handles.
jtk-edge-guidelineCSS class added to an edge guideline by the straight connector editor
jtk-orthogonal-handleAssigned to all handles in the orthogonal editor
jtk-orthogonal-segment-dragAssigned to segment drag handles in the orthogonal editor
jtk-orthogonal-segment-drag-ewAssigned to segment drag handles on vertical segments in the orthogonal editor. Indicates a segment can be dragged in the X axis
jtk-orthogonal-segment-drag-nsAssigned to segment drag handles on horizontal segments in the orthogonal editor. Indicates a segment can be dragged in the Y axis
jtk-straight-segment-deleteCSS class added to a delete handle by the straight connector editor
jtk-straight-segment-dragCSS class added to a drag handle by the straight connector editor
jtk-straight-handleCSS class added to all segment handles created by the segmented editor
jtk-straight-segment-splitCSS class added to a segment split handle by the straight connector editor

In addition to these classes, when an anchor is `Continuous`, the edge path editor uses an attribute on the anchor's element to indicate the current face of the element on which a dragged anchor would be located:

AttributeTypeDescription
jtk-anchor-face'left'|'right'|'top'|'bottom'Indicates the current face of the element on which a dragged anchor would be located

You can target the `jtk-anchor-face` attribute with a selector:

SelectorDescription
[jtk-anchor-face='left']Indicates the current target face is the left face
[jtk-anchor-face='right']Indicates the current target face is the right face
[jtk-anchor-face='bottom']Indicates the current target face is the bottom face
[jtk-anchor-face='top']Indicates the current target face is the top face

Path animation

During the lifetime of a path traversal, these classes are written to various parts of the UI

ClassDescription
jtk-animate-edge-traversableAssigned to all edges that will be travelled along by a path traversal. The class is removed at the end of the animation.
jtk-animate-edge-traversedAssigned to an edge that has been traversed by a path traversal. The class is removed at the end of the animation.
jtk-animate-edge-traversingAssigned to an edge that a path traversal is currently travelling along. The class is removed once the path traversal moves to the next vertex, or finishes.
jtk-animate-sourceAssigned to the element that is the source of a path traversal animation.
jtk-animate-targetAssigned to the element that is the target of a path traversal animation.
jtk-animate-node-traversableAssigned to all elements that will be traversed by a path traversal. The class is removed at the end of the animation.
jtk-animate-node-traversedAssigned to an element that has been traversed by a path traversal. The class is removed at the end of the animation.
jtk-animate-node-traversingAssigned to an element that a path traversal is currently passing through. The class is removed once the path traversal moves to the next edge, or finishes.

Drag and drop

Classes used by the drag/drop new nodes/groups functionality.

ClassDescription
jtk-drag-drop-activeAssigned to all elements that could be the target for some element that is being dragged from a palette
jtk-drag-drop-currentAssigned to an element that is being dragged from a palette
jtk-drag-drop-selected-elementAssigned to the currently selected element in a palette when in tap mode.

Plugins

Miniview

These are the classes you can use to style the Miniview. Note that vertices in the Miniview are sized to be identical to their mapped vertices in the related Surface (but the Miniview is zoomed out, so they are not 1:1 in size with their related vertices). You could of course use CSS to force a size for vertices in the Miniview, but this is not recommended: if your Surface contains vertices of various sizes but the Miniview uses a uniform size, the user may experience a certain discontinuity between the two views.

ClassDescription
jtk-miniviewAssigned by the Miniview to the DOM element into which it was rendered.
jtk-miniview-canvasAssigned by the Miniview to the DOM element into which is renders vertices.
jtk-miniview-click-to-centerAssigned by the Miniview to its container DOM element when 'clickToCenter' mode is switched on.
jtk-miniview-collapseAssigned by the Miniview to the collapse button.
jtk-miniview-collapsedAssigned by the Miniview to its container DOM element when it has been collapsed.
jtk-miniview-elementAssigned by the Miniview to a DOM element representing a node.
jtk-miniview-group-elementAssigned by the Miniview to a DOM element representing a group.
jtk-miniview-pannerAssigned by the Miniview to the DOM element that provides the visual cue showing the user how the viewport of the miniview relates to the entire dataset, and which the user can drag to pan.
jtk-miniview-panningAssigned by the Miniview to its canvas when the user is panning it.

Lasso

Classes assigned by the lasso plugin.

ClassDescription
jtk-lassoAssigned to the DOM element representing a lasso
jtk-lasso-maskAssigned to each DOM element representing part of the lasso mask, when the lasso is inverted mode. The lasso mask consists of four parts, one to the left, right, top and bottom of the area that has been lassoed.
jtk-lasso-mask-bottomAssigned to the DOM element representing the bottom part of the lasso mask, when the lasso is inverted mode.
jtk-lasso-mask-leftAssigned to the DOM element representing the left part of the lasso mask, when the lasso is inverted mode.
jtk-lasso-mask-rightAssigned to the DOM element representing the right part of the lasso mask, when the lasso is inverted mode.
jtk-lasso-mask-topAssigned to the DOM element representing the top part of the lasso mask, when the lasso is inverted mode.

Drawing Tools

ClassDescription
jtk-draw-borderCSS class set on the resize borders
jtk-draw-border-bCSS class set on the bottom border handle
jtk-draw-border-lCSS class set on the left border handle
jtk-draw-border-rCSS class set on the right border handle
jtk-draw-border-tCSS class set on the top border handle
jtk-draw-dragCSS class set on the element dragger that is added to the middle of the element when the drawing tools are active. The default stylesheet hides this element.
jtk-draw-handleCSS class set on the resize handles
jtk-draw-handle-blCSS class set on the bottom left corner resize handle
jtk-draw-handle-brCSS class set on the bottom right corner resize handle
jtk-draw-handle-tlCSS class set on the top left corner resize handle
jtk-draw-handle-trCSS class set on the top right corner resize handle
jtk-draw-skeletonCSS class set on the element that is the parent of drag handles when in handles resize mode.
jtk-draw-skeleton-bordersCSS class set on the element that is the parent of drag handles when in borders resize mode.
jtk-draw-skeleton-borders-visibleCSS class set on the draw tool's main element for some vertex when bordersVisible is set to true and the resize mode is DRAWING_TOOLS_RESIZE_METHOD_BORDERS

Snaplines

ClassDescription
jtk-snaplineAssigned to both horizontal and vertical snaplines when active
jtk-snapline-activeAssigned to an element attached to an active snapline
jtk-snapline-active-exactAssigned to an element attached to an active snapline and the elements on the snapline are exactly aligned
jtk-snapline-exactAssigned to both horizontal and vertical snaplines when the elements are exactly aligned
jtk-snapline-horizontalAssigned to horizontal snaplines when active
jtk-snapline-verticalAssigned to vertical snaplines when active

Pan buttons

Classes assigned by the PanButtons plugin

ClassDescription
jtk-surface-panAssigned by the PanButtons plugin to each of the pan buttons it adds around the surface.
jtk-surface-pan-activeAssigned by the PanButtons plugin when the user is pressing a pan button and a pan is in motion.
jtk-surface-pan-bottomAssigned by the PanButtons plugin to the pan button it adds on the bottom edge of the surface.
jtk-surface-pan-leftAssigned by the PanButtons plugin to the pan button it adds on the left edge of the surface.
jtk-surface-pan-rightAssigned by the PanButtons plugin to the pan button it adds on the right edge of the surface.
jtk-surface-pan-topAssigned by the PanButtons plugin to the pan button it adds on the top edge of the surface.

Grid background

ClassDescription
jtk-backgroundThe css class that will be added to a grid background's main element
jtk-background-borderThe css class that will be added to a grid background's border
jtk-background-gridThe css class that will be added to the major and minor dots/lines in a grid background
jtk-background-grid-dotted-majorThe class that will be added to the dots representing a grid background's grid lines (when gridType is GridTypes.dotted)
jtk-background-grid-dotted-minorThe class that will be added to the dots representing a grid background's grid tick marks (when gridType is GridTypes.dotted)
jtk-background-grid-majorThe class that will be added to the lines representing a grid background's grid lines (when gridType is GridTypes.lines)
jtk-background-grid-minorThe class that will be added to the lines representing a grid background's tick marks (when gridType is GridTypes.lines)

Vertex Drawing

Classes assigned by the vertex drawing plugin

ClassDescription
jtk-group-candidate-childThe CSS class added to any groups/nodes which have been lassoed and will be added to the new group being drawn
jtk-vertex-drawing-lassoThe CSS class added to the lasso used by the vertex drawing plugin.

Components

Dialogs

Classes used by the Dialogs manager.

ClassDescription
jtk-dialogSet this class on any dialog elements you serve with your page to allow JsPlumb to auto-discover them. Be sure to include a unique ID attribute on the element.
jtk-dialog-buttonAssigned to all buttons in a dialog
jtk-dialog-button-cancelAssigned to a dialog's cancel button
jtk-dialog-button-okAssigned to a dialog's OK button
jtk-dialog-buttonsThe dialog's button container element
jtk-dialog-contentThe content of a dialog (does not contain the titlebar)
jtk-dialog-overlayThe element that acts as the parent for dialog content
jtk-dialog-overlay-bottomAssigned to dialogs appearing in the bottom position
jtk-dialog-overlay-leftAssigned to dialogs appearing in the left position
jtk-dialog-overlay-rightAssigned to dialogs appearing in the right position
jtk-dialog-overlay-topAssigned to dialogs appearing in the top position
jtk-dialog-overlay-visibleAssigned to the dialog overlay element when the dialog is visible
jtk-dialog-overlay-xAssigned to dialogs appearing in the top or bottom positions.
jtk-dialog-overlay-yAssigned to dialogs appearing in the left or right positions.
jtk-dialog-titleThe titlebar of a dialog
jtk-dialog-underlayThe element that acts as the modal mask

Controls

Classes assigned by the controls component

ClassDescription
jtk-controlsThis class is written to the container element for a controls component.
jtk-clear-datasetAssigned to the clear dataset button
jtk-pan-modeAssigned to the Pan mode button
jtk-redoAssigned to the redo button
jtk-select-modeAssigned to the Select mode button
jtk-undoAssigned to the undo button
jtk-zoom-to-fitAssigned to the Zoom to fit button
jtk-selected-modeAssigned to either the pan/select mode button, when that mode is active.

Additionally, the controls component uses several attributes to reflect the current state:

AttributeTypeDescription
can-undo'true'|'false'Assigned to the `.jtk-controls` element, given a value of true or false depending on the undo stack.
can-redo'true'|'false'Assigned to the `.jtk-controls` element, given a value of true or false depending on the redo stack.
data-undoblankAssigned to the undo button.
data-redoblankAssigned to the redo button.

Export Controls

ClassDescription
jtk-export-controlsThis class is written to the container element for an export controls component.

SVG/PNG/JPG export

Classes used by the SVG/PNG/JPG exporter ui.

ClassDescription
jtk-export-cancelCancel button for export dialog
jtk-export-dimensionsDimensions drop down for export dialog
jtk-export-download-toolsElement containing buttons and dimensions picker
jtk-export-overlayContent element for SVG/PNG/JPG export dialog
jtk-export-underlayThe modal backing element for SVG/PNG/JPG export dialog

You can target various parts of the export UI with these selectors:

SelectorDescription
.jtk-export-overlay canvasTargets the canvas into which the preview is painted.
.jtk-export-overlay aTarget the 'download' link.

Shape library palette

Classes assigned by the shape library palette component

ClassDescription
jtk-shape-library-paletteAssigned to the root element for a shape library palette
jtk-shape-library-palette-selected-shapeWhen in tap mode, assigned to the currently selected shape.
jtk-shape-library-palette-setAssigned to the parent element for one set of icons in the shape library palette
jtk-shape-library-palette-filterAssigned to the drop-down that is shown when there are multiple shape sets in the palette
jtk-shape-library-palette-set-titleAssigned to the title element for a set of icons
jtk-shape-library-palette-shapeAssigned to each shape icon in the palette
jtk-shape-library-palette-labelAssigned to the label for each shape icon, if you have showLabels:true set.
jtk-shape-library-palette-lassoWhen in tap mode, this class is added to the lasso used to draw new vertices