Custom Views, Tooltips, Timeline & Headless Snapshots
Customize content nodes, cluster anchors, triangle faces, mesh edges, chronological timeline playback, and headless Node.js/Worker snapshots.
- Customization
- 19 min read
- Updated 2026-11-21
Key Takeaways
- Measure arbitrary React JSX cards or custom SVG glyphs automatically via offscreen getBBox() convex hull extraction.
- Swap SvgTriangleView and SvgEdgeView plugins independently—internal 1:4 drillable previews automatically inherit your SvgEdgeView.
- Enable chronological timeline playback with pinned full-corpus clusters, optional final-seeded item positions (pinned or adaptive), and configurable empty-cluster dimming.
- Render zero-DOM SSR SVG strings via @simplex-viz/svg/ssr (ready for @resvg/resvg-js without Puppeteer), offload solving to Web Workers via @simplex-viz/core/worker, and paint 2,000–10,000+ item corpora at 60 FPS with @simplex-viz/canvas.
SimplexViz separates mathematical solving (@simplex-viz/core + @simplex-viz/core/worker) and shared structural DOM/interaction utilities (@simplex-viz/core/dom) from scene rendering & framework adapters (@simplex-viz/svg, @simplex-viz/canvas, @simplex-viz/react, and @simplex-viz/wc). Every visual layer can be customized without rewriting layout or collision code.
1. Declarative React JSX Node Renderers
In @simplex-viz/react, pass renderContentNode or renderClusterNode returning standard <svg> JSX elements centered around (0, 0). The adapter measures each rendered <g> offscreen via getBBox(), builds a ConvexGeometry polygon, and feeds it directly into the SAT collision solver:
import { SimplexTopicGraph } from '@simplex-viz/react';
<SimplexTopicGraph
items={articles}
renderContentNode={(article, ctx, state) => (
<g>
<rect
x={-54}
y={-14}
width={108}
height={28}
rx={6}
fill="#0f172a"
stroke={state.interaction.isHovered ? '#f8fafc' : ctx.mixedColorHex}
strokeWidth={state.interaction.isHovered ? 2 : 1.25}
/>
<text textAnchor="middle" y={4} fill="#f8fafc" fontSize={10}>
{article.label.slice(0, 15)}
</text>
</g>
)}
/>;
2. Portable SvgTriangleView & SvgEdgeView Plugins
Both @simplex-viz/svg and @simplex-viz/react accept reusable view classes for background triangles and lattice edges:
- Built-in Triangle Views:
OklabTintTriangleSvgView(default),GradientTriangleSvgView,BarycentricSectorTriangleSvgView,BlueprintInsetTriangleSvgView,DensityHeatmapTriangleSvgView - Built-in Edge Views:
DashedMeshEdgeSvgView(default),ClusterTintedEdgeSvgView,PrecisionRailEdgeSvgView,MinimalHighlightEdgeSvgView
Whenever triangle.isDrillable is true, SvgRendererAdapter automatically renders the 3 internal 1:4 midpoint edges through your active edgeView, keeping outer and inner triangulation visually unified.
3. Headless SSR SVG Rendering (@simplex-viz/svg/ssr) & solveSimplexSnapshot
Need static SVG generation at build time (Astro, Next.js, Eleventy), OG/social cards, or headless PNG rasterization with @resvg/resvg-js without Puppeteer? Import renderSimplexSvgString from the dedicated zero-DOM subpath @simplex-viz/svg/ssr—it solves overlap-free layouts deterministically (including 'badges' via built-in proportional/monospace font metrics or a custom measureText callback) or renders a pre-solved SimplexLayoutSnapshot:
import { renderSimplexSvgString } from '@simplex-viz/svg/ssr';
const svg = renderSimplexSvgString(records, {
width: 1200,
height: 720,
getId: (r) => r.slug,
getTags: (r) => r.topics,
getLabel: (r) => r.title,
preset: 'badges',
theme: 'dark',
padding: 24,
title: 'Research Topics Atlas',
});
For custom HTML5 <canvas> / WebGL renderers or raw coordinate solving inside a Web Worker, call solveSimplexSnapshot from @simplex-viz/core:
import { solveSimplexSnapshot, rectToConvexPolygon } from '@simplex-viz/core';
const snapshot = solveSimplexSnapshot(records, {
width: 1280,
height: 800,
getId: (r) => r.slug,
getTags: (r) => r.topics,
measureContentHull: (r) => rectToConvexPolygon(r.title.length * 6.5 + 16, 24, 6),
});
// Zero overlaps guaranteed:
console.assert(snapshot.metrics.overlapCount === 0);
To keep the main thread at 60 fps on large corpora (500+ items or high-dimensional embeddings), offload QAP annealing and PBD/SAT solving via the dedicated @simplex-viz/core/worker subpath (attachSimplexWorkerHandler + createSimplexWorkerClient / solveSimplexSnapshotAsync). It cancels stale generations automatically during rapid resize or filter bursts, rehydrates non-cloneable domain TItem references on the main thread, and falls back asynchronously in SSR environments without a Worker global:
// worker.ts
import { attachSimplexWorkerHandler } from '@simplex-viz/core/worker';
attachSimplexWorkerHandler();
// main.ts
import { createSimplexWorkerClient } from '@simplex-viz/core/worker';
const workerClient = createSimplexWorkerClient(
() => new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' }),
);
const { snapshot } = await workerClient.solve(records, {
width: 1280,
height: 800,
getId: (r) => r.slug,
getTags: (r) => r.topics,
layoutStrategy: { kind: 'collision-driven' },
});
Pairing @simplex-viz/core/worker with High-Capacity Canvas 2D (@simplex-viz/canvas)
For large datasets (2,000–10,000+ items) where SVG DOM nodes limit pan/zoom frame rate, paint the solved snapshot directly with renderSimplexSnapshotToCanvas() or mount a full interactive SimplexCanvasController (createSimplexCanvas) with world-space frustum culling (cullMarginPx), automatic sub-pixel LOD simplification (lodThresholdPx), custom CanvasNodeRenderer / CanvasTriangleRenderer / CanvasEdgeRenderer hooks, and native exportPng():
import {
createSimplexCanvas,
renderSimplexSnapshotToCanvas,
} from '@simplex-viz/canvas';
// Option A — Stateless one-shot render of a Worker snapshot:
renderSimplexSnapshotToCanvas(canvasEl, snapshot, {
theme: 'dark',
preset: 'badges',
lodThresholdPx: 3.5,
});
// Option B — Full interactive 60 FPS Canvas controller (1:4 drill-down, timeline, marquee, WCAG keys):
const controller = createSimplexCanvas('#atlas', {
items: records,
preset: 'badges',
theme: 'dark',
lodThresholdPx: 3.5,
cullMarginPx: 48,
tooltip: true,
});
4. Composable Interactions, Tooltips, Mobile Touch-Scroll & Zero-Size Mount Recovery
Every interaction handler across @simplex-viz/core, @simplex-viz/svg, @simplex-viz/canvas, @simplex-viz/react, and @simplex-viz/wc (onContentClick, onClusterClick, onTriangleClick, onBackgroundClick, onLeftClick, onRightClick, onContentHover, onClusterHover, onTriangleHover, and custom onWheel) follows one uniform contract powered by @simplex-viz/core/dom:
- Return
voidorfalseto compose with built-in behavior (drill-down navigation, focus toggles, hover tooltips, or cursor zoom). - Return
trueto consume the event and suppress the built-in default for that interaction.
Across browser packages (@simplex-viz/svg, @simplex-viz/canvas, @simplex-viz/react, and @simplex-viz/wc), shared @simplex-viz/core/dom primitives handle four common browser behaviors uniformly:
- Viewport Edge-Flipped Tooltips (
computeSimplexTooltipCoords,buildSimplexTooltipContentModel): Built-in DOM and React JSX tooltips share the same target model, tag/weight formatting, drill-down hints, and dynamic viewport edge-flipping so tooltips never clip past container edges. - Mobile Touch-Scroll Direction-Locking (
touchScrollLockPx, default8): Setstouch-action: pan-yon the graph surface so vertical single-finger swipes yield smoothly to native page scrolling while horizontal swipes and two-finger pinches lock onto the canvas. PasstouchScrollLockPx={0}to restoretouch-action: nonefor full 2D touch panning. - Drag-vs-Click Peak-Displacement Tolerance (
clickTolerancePx, default12): Tracks peak pointer displacement frompointerdownacross the entire gesture and suppresses trailing clicks whenever movement exceedsclickTolerancePx—in bothfree-cameraanddrill-downmodes. - Zero-Size (
0×0) Container Mounts & Webfont Auto-Relayout (deferInitialLayout,relayoutOnFontLoad): If a graph mounts inside a hidden tab, modal, or before async CSS applies, controllers automatically invalidate cached hulls and perform a clean'initial'viewport re-initialization (with zero spring jump) on the first non-zeroResizeObserverentry viaobserveSimplexContainerResize(). PassdeferInitialLayout(trueor{ fallbackTimeoutMs }) to skip the provisional960×620solve entirely until the container becomes visible. Once webfonts finish loading (document.fonts.ready/loadingdone),relayoutOnFontLoad: trueautomatically re-measures hulls and re-solves layout.
5. Tag Display Labels, Cluster Badge Options & Geometric Shape Styling (getShape, shapeOptions)
You can tailor built-in presets to match your host design system without writing a custom VisualResolver or SvgNodeView:
- Decoupled Tag Display Labels (
formatTagLabel): PassformatTagLabel: (tag) => displayNameto keep canonical slugs (e.g.'autonomous-driving') strictly for clustering/matching while rendering human-readable labels ('Autonomous Driving') in cluster badges, breadcrumbs, semantic zoom subclusters, and tooltips. - Cluster Badge Formatting (
badgeOptions): Hide internalT1/T2prefix codes (showCode: false), apply word-aware truncation (maxTitleChars: 18), or transform titles (formatTitle: (title, { variant, cluster }) => ...)—or pass the same options directly tonew BadgeClusterSvgView(options). - Category-Driven & N-gon Shapes (
getShape): Bind items to fixed or data-driven shapes ('circle','triangle','square','diamond','pentagon','hexagon','heptagon','octagon','star', an arbitrary side count>= 3, or{ sides, rotationRad }) so shapes stay invariant across hierarchical1:4drill-down levels with exact convex SAT hulls. - Lightweight Hover, Dimming & Stroke Hooks (
shapeOptions): CustomizeGeometricShapeSvgViewwith{ hoverScale, hoverRingColor, dimmedOpacity, strokeColor, strokeWidth }(or callcontroller.setShapeOptions(...)at runtime).hoverScalescales the outer<g>on hover without altering collision hulls,dimmedOpacityreplaces the default0.34dimming factor once with zero double-dimming, andstrokeWidthis automatically factored intomeasureConvexHull()so wider strokes remain strictly overlap-free.
<SimplexTopicGraph
items={publications}
preset="badges"
formatTagLabel={(slug) => TOPIC_LABELS[slug] ?? slug}
badgeOptions={{ showCode: false, maxTitleChars: 18 }}
getShape={(pub) => (pub.kind === 'paper' ? 'hexagon' : pub.kind === 'talk' ? 'triangle' : 'pentagon')}
shapeOptions={{
hoverScale: 1.38,
hoverRingColor: '#38bdf8',
dimmedOpacity: 0.18,
strokeColor: '#0f172a',
strokeWidth: 1.8,
}}
deferInitialLayout
tooltip
/>
6. Chronological Timeline Playback, Final-Seeded Layout & Empty-Cluster Dimming
Turn any timestamped or bucketed dataset into an interactive chronological replay (0 → N) using the built-in timeline option in @simplex-viz/svg and @simplex-viz/react—or drive custom UI headlessly via createSimplexTimeline() (@simplex-viz/core) and useSimplexTimeline() (@simplex-viz/react):
import {
SimplexTopicGraph,
useSimplexGraphController,
useSimplexTimeline,
} from '@simplex-viz/react';
export function PublicationTimeline({ publications }: { publications: readonly Publication[] }) {
const { controllerRef } = useSimplexGraphController();
const timeline = useSimplexTimeline(controllerRef);
return (
<SimplexTopicGraph
controllerRef={controllerRef}
items={publications}
timeline={{
getTimestamp: (p) => p.year, // numeric year, Date, ISO string, or custom getFrameKey
stepIntervalMs: 850, // playback interval per step (ms)
showControls: true, // built-in theme-adaptive Play/Pause/Step/Scrubber HUD
position: 'bottom', // 'bottom' | 'top'
loop: false, // optionally loop back to frame 0 after end
includeEmptyStart: false, // optionally prepend an empty frame 0
autoFinalSeed: true, // wraps clustering in createFinalSeededClusteringStrategy
autoFinalSeedLayout: 'adaptive', // false | 'pinned' | 'adaptive' (createFinalSeededLayoutStrategy)
emptyClusterBehavior: 'dim', // 'normal' | 'dim' | 'hide' for 0-item future clusters
}}
onTimelineStateChange={(state) => {
console.log(state.activeLabel, state.activeItemCount, timeline.isReady);
}}
/>
);
}
Independent Control Over All Three Timeline Axes
- Cluster Stability (
autoFinalSeed/createFinalSeededClusteringStrategy): Enabled by default (autoFinalSeed: true), wrapping your active clustering strategy so canonical full-corpus clusters, mesh vertices, UIDs, and OKLab hues stay pinned across frames0..N. SetautoFinalSeed: falseto let clusters re-form dynamically at each chronological step, or wrap manually viacreateFinalSeededClusteringStrategy(base, { seedItems }). - Item Position & Scale Stability (
autoFinalSeedLayout/createFinalSeededLayoutStrategy):false(default) — Re-solves layout dynamically on every frame using your activelayoutStrategy(for example,createWarmStartPbdLayoutStrategy()orcreateCollisionDrivenLayoutStrategy()).'pinned'— Wraps your active layout strategy increateFinalSeededLayoutStrategy(base, { scaleMode: 'pinned' })so items stay locked to their canonical full-corpus(x, y)coordinates and final scales with zero drift.'adaptive'— Keeps canonical(x, y)coordinates pinned while symmetrically expanding sparse early-frame items up to1.0xwith exact SAT0.0 pxoverlap verification.
- Empty / Future Cluster Visibility (
emptyClusterBehavior): Available both insidetimelineand directly as a top-level prop/method (emptyClusterBehavior/setEmptyClusterBehavior()):'normal'(default) — All pinned clusters render at full opacity even before their first member item enters.'dim'— Clusters with0active members stay visible as dimmed landmarks until their first item arrives.'hide'— Clusters with0active members are hidden until activated by an incoming item.
Because estimateClusterCount(ctx) and ClusteringStrategyContext receive explicit reason ('initial' | 'items' | 'viewport' | 'mesh' | 'strategy') and viewport dimensions, resizing the canvas cleanly re-seeds both final-seeded clustering and final-seeded layout against the canonical full corpus.
Cookbook: Binding an External Host Timeline Bar (showControls: false)
When your application already provides a site-wide scrubber or Play/Pause bar, pass showControls: false and formatStepLabel to disable the built-in HUD while letting SimplexSvgController (or <simplex-topic-graph>) manage canonical cluster seeding, item slicing, and rAF playback for you:
import { createSimplexSvg } from '@simplex-viz/svg';
const controller = createSimplexSvg('#atlas', {
items: publications,
timeline: {
showControls: false,
getTimestamp: (p) => p.year,
formatStepLabel: (frame) => `${frame.timestamp} (${frame.cumulativeItems.length} items)`,
autoFinalSeed: true,
emptyClusterBehavior: 'dim',
},
});
// 1. Sync your existing HTML / Preact / React scrubber directly from controller state:
const unsubscribe = controller.subscribeTimeline((state) => {
if (!state) return;
scrubber.max = String(state.totalSteps);
scrubber.value = String(state.step);
labelEl.textContent = state.activeLabel;
playBtn.textContent = state.playing ? 'Pause' : 'Play';
});
// 2. Drive playback without writing a manual setItems() slicing adapter:
playBtn.onclick = () => (controller.timeline?.getState().playing ? controller.timeline.pause() : controller.timeline?.play());
prevBtn.onclick = () => controller.timeline?.stepBy(-1);
nextBtn.onclick = () => controller.timeline?.stepBy(1);
resetBtn.onclick = () => controller.timeline?.resetToEnd();
scrubber.oninput = () => controller.timeline?.seek(Number(scrubber.value));
The exact same binding works on <simplex-topic-graph> (el.subscribeTimeline(...) + el.getTimeline()) and in React via useSimplexTimeline(controllerRef) or handle.subscribeTimeline(...).
7. Zero-Relayout Item Filtering, Batched Updates & WCAG 2.1 AA Accessibility
Three production ergonomics features keep interactive dashboards responsive, deterministic, and accessible out of the box:
- Zero-Relayout Item Filtering (
itemFilter,itemFilterMode,setItemFilter()): Filter content items visually in'dim'(default) or'hide'mode without re-clustering or re-solving the SAT layout. Every node preserves its exact(x, y)coordinate so toggling search queries or facet filters produces zero spring jumps. In'hide'mode, filtered-out items are non-interactive (pointer-events: none) and automatically excluded from both pointer hit-testing and keyboard navigation. - Re-entrant
batch()& AtomicsetOptions(): Wrap multiple imperative updates insideengine.batch(fn)orcontroller.batch(fn), or pass a partial update object tocontroller.setOptions(opts)(SimplexSvgUpdateOptions), to coalesce changes (such astheme,preset,meshOptions,layoutOptions,itemFilter, and strategies) into a single minimal pipeline recomputation. In@simplex-viz/react,<SimplexTopicGraph />automatically batches all dynamic prop changes per render commit inside onecontroller.batch(...)pass. - WCAG 2.1 AA Keyboard Navigation & Screen-Reader Support (
ariaLabel,keyboardNavigation): Enabled by default (keyboardNavigation: true), the root<svg>exposes a single tabstop (role="application",tabindex="0",aria-activedescendant) with full keyboard traversal (ArrowRight/ArrowDownnext,ArrowLeft/ArrowUpprevious,Home/Endfirst/last,Enter/Spaceactivate/drill/focus,Escapeclear focus or drill up), a zoom- and theme-adaptive high-contrast double-halo SVG focus ring (g.sv-a11y-focus-ring), collision-free instance-scoped ARIA IDs and roles on clusters/items/triangles/breadcrumbs, and polite screen-reader announcements (div.sv-sr-announcer[role="status"][aria-live="polite"]).
<SimplexTopicGraph
items={publications}
itemFilter={(p) => p.year >= minYear}
itemFilterMode="dim"
ariaLabel="Interactive research publications topic map"
keyboardNavigation
tooltip
/>
8. Linked-View Search, Programmatic Focus/Zoom & Client-Side SVG/PNG Export
Synchronize external search boxes, tables, or detail panels with the graph without mutating dataset layout, and export publication-grade SVG or HiDPI PNG snapshots directly from the live canvas:
- Programmatic Search & Linked-View API (
setHighlightedIds,focusItem,zoomToItem): Pass anyIterable<string> | nulltosetHighlightedIds()(or the ReacthighlightedIdsprop) to emphasize matching items. CallfocusItem(itemId, { highlight?, hover?, announce? })to focus a node with synchronized hover tooltip, SVG focus ring, and polite screen-reader announcement. CallzoomToItem(itemId, { zoom?, maxDrillSteps?, focus? })to smoothly frame an item infree-cameramode or automatically drill down across covering triangles indrill-downmode. - Client-Side Snapshot Export (
exportSvg,exportPng):exportSvg(options?)clones the live SVG, inlines resolved CSS custom properties and visual styles (inlineStyles: true), injects a theme-matched or custom background<rect>(includeBackground: true), expandsviewBoxbypadding, strips transient focus rings by default (includeFocusRing: false), and returns a standalone<svg>string.exportPng(options?)rasterizes that SVG on an offscreen HiDPI<canvas>(scale: 2default) and resolves to aBlob(format: 'blob', default) or base64data:URL (format: 'dataUrl').
// From a search bar, table row click, or export button:
handle.setHighlightedIds(searchResultIds);
handle.zoomToItem(selectedId, { zoom: 2.2, maxDrillSteps: 4 });
const svgString = handle.exportSvg({ padding: 24, title: 'Publications Atlas' });
const pngBlob = await handle.exportPng({ scale: 2, padding: 24 });
9. Multi-Selection (Shift+Click / Shift+Drag), Reduced Motion & Deep-Link View State
Build analytical workflows and shareable URLs without custom interaction plumbing:
- Interactive Multi-Selection (
selectedIds,marqueeSelection,onSelectionChange): Independent fromhighlightedIdsandpinnedIds. Users canShift+Clickitems to toggle selection,Shift+Dragto select rectangular regions with a marquee overlay (automatically excluded fromexportSvg()), toggle selection via keyboard (Shift+Enter/Shift+Space), or pressEscapeto clear. Built-in node views and@simplex-viz/svg/ssrrender high-contrast violet selection rings. - Automatic
prefers-reduced-motion(reducedMotion: 'auto' | boolean): Subscribes live to(prefers-reduced-motion: reduce), setsdata-reduced-motion="true", and snaps node springs, camera flights, zoom transitions, and visual morphs immediately when active. - Serializable View State (
getViewState,restoreViewState): Captures a JSON-safeSimplexViewState(version: 1,camera,zoomPath, cluster/triangle/item focus,highlightedIds,selectedIds,pinnedIds, and optionaltimelineStep).restoreViewState()snaps immediately by default ({ animate?: boolean }), replays drill-down steps cleanly from root, and gracefully ignores stale IDs or unreachable steps without throwing.
// Deep-link serialization into URL hash / query params or localStorage:
const viewState = handle.getViewState();
const encoded = encodeURIComponent(JSON.stringify(viewState));
// Restore on page load (snaps immediately, ignores stale IDs safely):
handle.restoreViewState(JSON.parse(decodeURIComponent(encoded)));