π Getting StartedΒΆ
<VisualliRenderer /> is a React component that renders interactive, hierarchical mindmap visualizations from .visualli files.
π¦ InstallationΒΆ
npm install @visualli/react
yarn add @visualli/react
pnpm add @visualli/react
That's the only install command you need. It automatically pulls in the major dependencies:
- π§±
@visualli/coreβ the parsing engine and document model - βοΈ
React&React DOM(β₯ 18.3) β peer dependencies for your app
β‘ UsageΒΆ
Provide exactly one data source β visualliFile or visualliString:
visualliFileβ aFileobject (from<input type="file">) or a string path. The component fetches, reads, and parses it automatically.visualliStringβ raw JSONL content as a string. No preprocessing needed.
From a file pathΒΆ
import { VisualliRenderer } from '@visualli/react';
function App() {
return (
<VisualliRenderer
visualliFile="/data/document.visualli"
theme="light"
width="100%"
height="600px"
/>
);
}
From a stringΒΆ
const data = `{"type":"meta","version":"1.0","title":"My Mind Map"}
{"type":"layer","id":"root","level":0,"nodes":[{"id":"1","position":{"x":0,"y":0},"data":{"label":"Central Idea","summary":"The main concept"}}]}`;
<VisualliRenderer visualliString={data} theme="auto" />
From a file uploadΒΆ
import { useState } from 'react';
import { VisualliRenderer } from '@visualli/react';
function FileViewer() {
const [file, setFile] = useState<File | null>(null);
return (
<div>
<input
type="file"
accept=".visualli"
onChange={(e) => setFile(e.target.files?.[0] || null)}
/>
{file && (
<VisualliRenderer
visualliFile={file}
theme="light"
width="100%"
height="80vh"
/>
)}
</div>
);
}
β¨ FeaturesΒΆ
- π¨ Beautiful visualizations β sketchy, hand-drawn aesthetic with smooth animations
- π High performance β spatial indexing keeps 10,000+ nodes smooth
- π Themes β
light,dark, orauto(follows system preference) - β‘ Web Worker parsing β non-blocking parsing, on by default
- πΊοΈ Interactive navigation β pan, zoom, auto layer navigation, breadcrumbs
- π§ Fully typed β complete TypeScript definitions included
β οΈ Error HandlingΒΆ
The renderer shows built-in states so you don't have to:
| State | What the user sees |
|---|---|
| π No data | "No .visualli file provided" with a hint to pass visualliFile or visualliString |
| β³ Loading | Animated indicator while fetching/parsing |
| β Error | Clear message on parse failure, e.g. "Failed to parse JSON at line 5: Unexpected token" |
π Browser SupportΒΆ
| Browser | Version |
|---|---|
| Chrome | β₯ 90 |
| Firefox | β₯ 88 |
| Safari | β₯ 14 |
| Edge | β₯ 90 |
Requires ES2020, Canvas API, and CSS Grid/Flexbox. Web Workers and prefers-color-scheme are optional (used by useWorker and theme="auto").