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
defaultNodeStyle: {
badges: node => node.getData().notes
? [{ text: String(node.getData().notes), title: 'Notes', onClick: () => openNotes(node) }]
: [],
}Properties
color?
optionalcolor:string
Defined in: interfaces/RendererOptions.ts:401
Any CSS colour.
Default
var(--pvt-badge-color)
iconClass?
optionaliconClass:string
Defined in: interfaces/RendererOptions.ts:407
iconUnicode?
optionaliconUnicode:string
Defined in: interfaces/RendererOptions.ts:408
onClick()?
optionalonClick: (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
badge
NodeBadge
Returns
void
position?
optionalposition: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?
optionalsvgIcon:string
Defined in: interfaces/RendererOptions.ts:410
Inline SVG markup, sanitized before it reaches the DOM.
text?
optionaltext: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?
optionaltitle:string
Defined in: interfaces/RendererOptions.ts:412
Native tooltip, rendered as a real <title>. Does not suppress the graph's own tooltip.