Skip to main content

CSS

The various components and plugins in the Toolkit offer a rich set of CSS classes that you can use to customize your UI. The Toolkit ships several CSS files (inside the /css directory of the @jsplumbtoolkit/browser-ui package) that contain sane defaults:

  • jsplumbtoolkit.css Styles for the UI core, including such things as absolute positioning for nodes/groups, styles to setup a surface widget and its various plugins, etc. You should include this stylesheet in your cascade when you start working with the Toolkit.

  • jsplumbtoolkit-connector-editors.css Styles for the various edge path editors.

  • jsplumbtoolkit-controls.css Styles for the controls helper component

  • jsplumbtoolkit-dialogs.css Styles for the dialogs

  • jsplumbtoolkit-edge-type-picker.css Styles for the edge type picker, as seen in the flowchart builder starter app

Surface

This is a full list of CSS classes used by the surface widget. These are published in jsplumbtoolkit.css.

ClassDescription
jtk-surfaceAssigned to an element that is acting as a surface widget
jtk-surface-touch-deviceAssigned to an element that is acting as a surface widget when the device supports touch events
jtk-surface-pointer-deviceAssigned to an element that is acting as a surface widget when the device supports pointer events
jtk-surface-direct-renderAssigned to an element that is acting as a surface widget in "direct render" mode, ie. readonly.
jtk-surface-nopanAssigned to a surface for which enablePan was set to false in the render args
jtk-surface-canvasAssigned to the work area of a surface widget. This canvas element will have been created automatically by the surface and is not normally something you will need to style. If you do attach some styles, you should be careful to ensure that this element always has position:relative; set.
jtk-surface-lassoAssigned to the "lasso" element used when selecting elements in a surface using the mouse.
jtk-surface-panAssigned to all of the pan buttons in a surface, regardless of which direction they control
jtk-surface-pan-topAssigned to the pan button that appears on the top edge of the surface.
jtk-surface-pan-leftAssigned to the pan button that appears on the topleft edge of the surface.
jtk-surface-pan-rightAssigned to the pan button that appears on the right edge of the surface.
jtk-surface-pan-bottomAssigned to the pan button that appears on the bottom edge of the surface.
jtk-surface-selected-elementAssigned to any element that is part of some surface's current selection.
jtk-lassoAssigned to the selection lasso element

Element dragging

ClassDescription
jtk-drag-activeAssigned to a group element that is a candidate drop target for a node or group that is currently being dragged
jtk-drag-hoverAssigned to a group element that is the current drop target for a node or group that is being dragged
jtk-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.

Miniview

These are the classes you can use to style the Miniview widget. These are published in jsplumbtoolkit.css. 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 to an element that is acting as a Miniview's container
jtk-miniview-canvasAssigned to the work area in the Miniview
jtk-miniview-pannerAssigned to the element used to pan the Surface from the Miniview
jtk-miniview-elementAssigned to all elements on the Miniview's canvas

Drawing Tools

These are published in jsplumbtoolkit.css.

ClassDescription
jtk-draw-skeletonAssigned to the outline of the drawing tools attached to some element
jtk-draw-handleAssigned to the individual resize handles
jtk-draw-handle-tlAssigned to the top left resize handle
jtk-draw-handle-trAssigned to the top right resize handle
jtk-draw-handle-brAssigned to the bottom right resize handle
jtk-draw-handle-blAssigned to the bottom left resize handle

Snaplines plugin

These are published in jsplumbtoolkit.css.

ClassDescription
jtk-snaplineAssigned to both horizontal and vertical snaplines when active
jtk-snapline-horizontalAssigned to horizontal snaplines when active
jtk-snapline-verticalAssigned to vertical snaplines when active
jtk-snapline-exactAssigned to both horizontal and vertical snaplines when the elements are exactly aligned
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

Edge path editors

These styles are published in the stylesheet jsplumbtoolkit-connector-editors.css.

ClassAssigned ToPurpose
jtk-orthogonal-handleSegment drag handles in orthogonal editorSegments can be dragged by these handles
jtk-orthogonal-segment-dragSegment drag handles in orthogonal editorSegments can be dragged by these handles
jtk-orthogonal-segment-drag-nsSegment drag handles on horizontal segmentsIndicates a segment can be dragged in the Y axis
jtk-orthogonal-segment-drag-ewSegment drag handles on vertical segmentsIndicates a segment can be dragged in the X axis
jtk-bezier-handleControl point drag handles in bezier editorControl points can be dragged by these handles
jtk-bezier-handle-control-pointControl point drag handles in bezier editorControl points can be dragged by these handles
jtk-bezier-handle-control-point-1First control point handle, bezier editor onlyIn the StateMachine editor this is not assigned
jtk-bezier-handle-control-point-2Second control point handle, bezier editor onlyIn the StateMachine editor this is not assigned
jtk-bezier-guidelineGuidelines in the Bezier/StateMachine editors
jtk-anchor-placeholderAnchor drag placeholdersAdded 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-anchor-candidateDrag candidates for anchorsAdded to the elements drawn to show where a certain anchor may be relocated to (for dynamic anchors)
jtk-edge-deleteDelete buttonAssigned to the optional delete button overlay that the edge path editor can add