Usage guidesInteraction

Tooltip

Show details for a node or edge on hover or click.

Show details for a node or edge on hover or click.

Configuration

Set the trigger with trigger and return the content from getContent. In click mode, click the same element again or click empty canvas to close the tooltip.

behaviors: [{ type: 'tooltip', trigger: 'hover', delay: 120 }],

Example

Loading example…
Hover API, DB, or an edge for 120ms; leaving hides it. Cache nodes show no tooltip
const tooltip: BuiltInBehaviorOptionsMap['tooltip'] = {
  type: 'tooltip', trigger: 'hover', delay: 120, className: 'docs-hover-tooltip',
  enable: (ctx) => ctx.nodeId !== 'Cache',
  getContent: (ctx) => {
    const card = document.createElement('div');
    card.style.cssText = 'padding:10px 14px;border-radius:8px;background:#163B65;color:white;font:12px system-ui;box-shadow:0 4px 16px #163b6533;';
    const title = document.createElement('strong');
    title.textContent = String(ctx.data?.label ?? ctx.nodeId ?? ctx.edgeId ?? '');
    const detail = document.createElement('div');
    detail.textContent = ctx.itemType === 'node'
      ? `Requests: ${Number(ctx.data?.requests ?? 0)}`
      : `${ctx.source} → ${ctx.target}`;
    card.append(title, detail);
    return card;
  },
};

Run the example and view the full code · Options and defaults · See click triggering and styling