Skip to content
This is the alpha v4 version website. Looking for the v3 documentation?

Style properties

Every node and edge has a set of built-in style properties that control its visual appearance. These properties are set through the styles system using any style value type.

Custom properties can be added via primitives variables.

Node style properties

These are the built-in style properties available for nodes:

Position and geometry

PropertyTypeDescription
xnumberX coordinate in graph space
ynumberY coordinate in graph space
sizenumberNode size (actual pixel size depends on autoRescale, itemSizesReference, and zoomToSizeRatioFunction settings)
shapestringShape name (e.g. "circle", "square"). Must match a shape declared in primitives.nodes.shapes

Appearance

PropertyTypeDescription
colorstringNode fill color
opacitynumberOpacity from 0 (transparent) to 1 (opaque)
visibility"visible" | "hidden"Whether the node is visible

Interaction

PropertyTypeDescription
cursorstringCSS cursor to show when hovering (e.g. "pointer")

Ordering

PropertyTypeDescription
depthstringDepth layer for render ordering (must match a layer in primitives.depthLayers)
zIndexnumberZ-index within the depth layer

Label properties

PropertyTypeDescription
labelstringLabel text content
labelColorstringLabel text color
labelSizenumberLabel font size in pixels
labelFontstringLabel font family (e.g. "Georgia, serif")
labelVisibility"auto" | "visible" | "hidden""auto" uses density-based culling, "visible" forces display
labelPosition"right" | "left" | "above" | "below" | "over"Label position relative to node
labelAnglenumberLabel rotation angle in radians
labelDepthstringDepth layer for label rendering (defaults to depth)
labelAttachmentstring | nullLabel attachment name (references primitives.nodes.labelAttachments)
labelAttachmentPlacement"below" | "above" | "left" | "right"Attachment position relative to label
labelBackgroundColorstringLabel background fill color (transparent = no background)
labelBackgroundPaddingnumberPadding around the label background in pixels
labelCursorstringCSS cursor to show when hovering the label (requires nodeLabelEvents)

Backdrop properties

Backdrops render a background shape behind nodes and their labels, typically used for hover effects.

PropertyTypeDescription
backdropVisibility"visible" | "hidden"Whether the backdrop is shown
backdropColorstringBackdrop fill color
backdropShadowColorstringShadow color
backdropShadowBlurnumberShadow blur radius in pixels
backdropPaddingnumberPadding around the node and label in pixels
backdropBorderColorstringBorder color
backdropBorderWidthnumberBorder width in pixels
backdropCornerRadiusnumberCorner radius in pixels
backdropLabelPaddingnumberLabel-specific padding (-1 falls back to backdropPadding)
backdropArea"both" | "node" | "label"Which area the backdrop covers

Edge style properties

Appearance

PropertyTypeDescription
sizenumberEdge thickness in pixels
colorstringEdge color
opacitynumberOpacity from 0 to 1
visibility"visible" | "hidden"Whether the edge is visible
pathstringPath type (e.g. "straight", "curved"). Must match a path in primitives.edges.paths
headstringHead (target) extremity type (e.g. "arrow", "none")
tailstringTail (source) extremity type
selfLoopPathstringPath type override for self-loop edges
parallelPathstringPath type override for parallel edges
parallelSpreadnumberSpread factor for parallel edge separation (default: 0.25)

Interaction

PropertyTypeDescription
cursorstringCSS cursor to show when hovering (e.g. "pointer")

Ordering

PropertyTypeDescription
depthstringDepth layer for render ordering
zIndexnumberZ-index within the depth layer

Label properties

PropertyTypeDescription
labelstringLabel text content
labelColorstringLabel text color
labelSizenumberLabel font size in pixels
labelFontstringLabel font family
labelVisibility"auto" | "visible" | "hidden"Label visibility mode
labelPositionnumber | "over" | "above" | "below" | "auto"Position mode, or a ratio along the edge (0 = source, 0.5 = middle, 1 = target)
labelDepthstringDepth layer for label rendering (defaults to depth)
labelBackgroundColorstringLabel background fill color (transparent = no background)
labelBackgroundPaddingnumberPadding around the label background in pixels
labelCursorstringCSS cursor to show when hovering the label (requires edgeLabelEvents)

Stage style properties

Stage styles apply to the sigma container itself. Unlike node and edge styles, stage styles only support graph state conditionals (not attribute bindings).

PropertyTypeDescription
cursorstringCSS cursor on the stage (fallback when nothing hovered)
backgroundstringStage background color

Stage styles support the same rule-level conditionals as nodes/edges, but predicates match against graph state flags (e.g. isDragging, hasHovered):

const renderer = new Sigma(graph, container, {
styles: {
nodes: { cursor: "grab" },
stage: {
whenState: "isDragging",
then: { cursor: "grabbing" },
},
},
});

Custom variables

Additional style properties can be declared via primitives.nodes.variables and primitives.edges.variables. These are used by custom rendering layers.

import { layerBorder } from "@sigma/node-border";
import { layerFill } from "sigma/rendering";
const renderer = new Sigma(graph, container, {
primitives: {
nodes: {
variables: {
borderSize: { type: "number", default: 2 },
borderColor: { type: "color", default: "#ffffff" },
},
layers: [
layerFill(),
layerBorder({ borders: [{ size: { attribute: "borderSize" }, color: { attribute: "borderColor" } }] }),
],
},
},
styles: {
nodes: {
borderSize: 3,
borderColor: { attribute: "borderColor", defaultValue: "#000" },
},
},
});

Once declared, custom variables can be styled exactly like built-in properties, with any style value type.