Features
- Force-directed graph layout – Automatic positioning using D3 force simulation with smart collision detection
- Multiple layout modes – Switch between
force,tree, andradialgraph views - Interactive – Click, hover, and right-click interactions on nodes, links, and background
- Theme support – Light and dark mode with customizable colors
- Performance – Optimized rendering with HTML5 Canvas, including viewport culling and low-zoom draw skipping for large graphs
- Loading states – Built-in skeleton loading with pulse animation
- Customizable – Colors, sizes, behaviors, and custom rendering functions
- TypeScript support – Full type definitions included
- Web Component – Works with any framework or vanilla JavaScript
- Viewport control – Zoom, pan, and auto-fit functionality
Installation
Quick Start
Vanilla JavaScript
React / TypeScript
API
Methods
Configuration Options
Configuration is passed tosetConfig() as a ForceGraphConfig object.
Top-Level Options
Event Handlers
Layout Modes
UselayoutMode in setConfig to choose the graph view style:
Force (default)
The default physics-based layout using D3 force simulation with configurable physics parameters.Tree
Radial
Data Types
Node
Link
Custom Rendering
You can provide custom rendering functions for nodes and links:node-mode and link-mode HTML attributes control how custom rendering combines with default rendering:
replace(default for nodes) – Uses custom rendering exclusivelybefore– Renders custom content before default renderingafter(default for links) – Renders custom content after default rendering
Large-Graph Optimizations
For graphs with thousands of nodes and links, configure viewport culling and low-zoom draw skipping:Utility Functions
The package exports utility functions for data manipulation:Performance Tips
- Large graphs – Disable animation (
setAnimation(false)) once the layout stabilizes - Static graphs – Use a deterministic layout (
setLayout('tree')) to avoid simulation overhead - Custom rendering – Optimize your custom
nodeCanvasObjectandlinkCanvasObjectfunctions - Viewport – Use
getViewport()andsetViewport()to preserve the user’s view when updating data - Very large graphs – Enable viewport culling via the
largeGraphoption
Browser Support
- Chrome / Edge (latest)
- Firefox (latest)
- Safari (latest)
Links
Frequently Asked Questions
What is FalkorDB Canvas?
What is FalkorDB Canvas?
FalkorDB Canvas is a standalone web component for visualizing FalkorDB graphs with force-directed layouts. It is published on npm as @falkordb/canvas and is the same component that powers graph visualization inside FalkorDB Browser.
How do I install FalkorDB Canvas?
How do I install FalkorDB Canvas?
Install it from npm with
npm install @falkordb/canvas, import the package, and place a falkordb-canvas element in your page. Importing the module registers the custom element for you.Can I use FalkorDB Canvas with React, Vue, or Angular?
Can I use FalkorDB Canvas with React, Vue, or Angular?
Yes. It is a standard Web Component, so it works with any framework or with plain JavaScript. The package ships full TypeScript definitions, and the Quick Start above includes both a vanilla JavaScript and a React/TypeScript example.
Does FalkorDB Canvas query FalkorDB directly?
Does FalkorDB Canvas query FalkorDB directly?
No. Canvas is a rendering component — it draws whatever nodes and links you hand it through
setData(). Run your Cypher query with a FalkorDB client, convert the result into nodes and links, and pass that to the canvas.What layout modes does FalkorDB Canvas support?
What layout modes does FalkorDB Canvas support?
Three:
force (the default D3 force simulation), tree (hierarchical), and radial. Switch between them with setLayout('tree') and tune each one through setLayoutOptions().How do I visualize a large graph without slowing down the browser?
How do I visualize a large graph without slowing down the browser?
Enable the
largeGraph options to turn on viewport culling and skip expensive details at low zoom, call setAnimation(false) once the layout settles to stop the simulation, and prefer a deterministic layout such as tree for static graphs. getCullingStats() shows how many nodes and links are actually being drawn.How do I keep the user's zoom and position when I update the data?
How do I keep the user's zoom and position when I update the data?
Save the view with
getViewport() before replacing the data, then restore it with setViewport() afterwards. This prevents the jarring re-fit that otherwise happens on every setData() call.Which browsers does FalkorDB Canvas support?
Which browsers does FalkorDB Canvas support?
The latest versions of Chrome, Edge, Firefox, and Safari. It needs Custom Elements, Shadow DOM, ES Modules, and HTML5 Canvas support.