Skip to content

pivotick v3.0.0


pivotick / RendererOptions / NodeBadge

Interface: NodeBadge ​

Defined in: interfaces/RendererOptions.ts:393

A small indicator pinned to a node's rim — what KeyLines and ReGraph call a glyph.

Badges are a decoration channel of their own, so a node can carry a fact that color, shape, size, iconClass and imagePath are already spent on. They describe only the node they sit on: a collapsed cluster does not aggregate its children's badges — walk node.children yourself if you want that.

Example ​

js
defaultNodeStyle: {
    badges: node => node.getData().notes
        ? [{ text: String(node.getData().notes), title: 'Notes', onClick: () => openNotes(node) }]
        : [],
}

Properties ​

color? ​

optional color: string

Defined in: interfaces/RendererOptions.ts:401

Any CSS colour.

Default ​

var(--pvt-badge-color)


iconClass? ​

optional iconClass: string

Defined in: interfaces/RendererOptions.ts:407


iconUnicode? ​

optional iconUnicode: string

Defined in: interfaces/RendererOptions.ts:408


onClick()? ​

optional onClick: (event, node, badge) => void

Defined in: interfaces/RendererOptions.ts:420

Called when the badge is clicked, before InterractionCallbacks.onBadgeClick.

Declaring it makes the badge take the pointer cursor and consume the click, so the node is not also selected. A badge without one stays transparent to the node underneath. Pressing a badge still drags the node either way.

Parameters ​

event ​

PointerEvent

node ​

Node

badge ​

NodeBadge

Returns ​

void


position? ​

optional position: NodeBadgePosition

Defined in: interfaces/RendererOptions.ts:399

Which corner to sit on. Omit it and the badge is auto-placed in the first free corner, clockwise from 'ne'. An explicit position is honoured verbatim, even where that overlaps another badge or the expand affordance.


svgIcon? ​

optional svgIcon: string

Defined in: interfaces/RendererOptions.ts:410

Inline SVG markup, sanitized before it reaches the DOM.


text? ​

optional text: string

Defined in: interfaces/RendererOptions.ts:406

A count, or one or two characters. Longer text grows the badge into a pill; past three characters it renders as 99+. Takes precedence over any icon on the same badge.


title? ​

optional title: string

Defined in: interfaces/RendererOptions.ts:412

Native tooltip, rendered as a real <title>. Does not suppress the graph's own tooltip.