Examples
Interactive examples demonstrating all4one's features. Open these demos in StackBlitz to see them in action.
Basic Organization Chart
A simple org chart with default settings.
tsx
import All4One from 'all4one'
const data = {
nodes: [
{ id: '1', data: { label: 'Sarah Chen', positionName: 'CEO' } },
{ id: '2', pid: '1', data: { label: 'Mike Johnson', positionName: 'CTO' } },
{ id: '3', pid: '1', data: { label: 'Lisa Wang', positionName: 'CFO' } },
{ id: '4', pid: '2', data: { label: 'Alex Kim', positionName: 'Engineering Lead' } },
{ id: '5', pid: '2', data: { label: 'Jordan Lee', positionName: 'Product Manager' } },
]
}
export default function BasicExample() {
return (
<div style={{ width: '100vw', height: '100vh' }}>
<All4One data={data} />
</div>
)
}Interactive with Collapsing
Enable node collapsing to handle large hierarchies.
tsx
<All4One
data={data}
collapsible={true}
layoutStyle="treeLeftOffset"
/>Custom Theme
Apply the Glass theme with a gradient background.
tsx
<All4One
data={data}
nodeTheme="glass"
backgroundColor="linear-gradient(135deg, #667eea 0%, #764ba2 100%)"
edgeType="curved-edge"
edgeAnimated={true}
/>Neon Dark Theme
High-contrast dark mode with glowing edges.
tsx
<All4One
data={data}
nodeTheme="neon"
backgroundColor="#0a0a0a"
edgeType="oval-edge"
edgeColor="#06b6d4"
edgeAnimated={true}
/>Horizontal Layout
Switch to left-to-right layout direction.
tsx
<All4One
data={data}
layoutDirection="LR"
layoutStyle="treeRightOffset"
/>With Photos
Display employee photos in nodes.
tsx
const data = {
nodes: [
{
id: '1',
data: {
label: 'Sarah Chen',
positionName: 'CEO',
photo: 'https://i.pravatar.cc/150?img=1'
}
},
{
id: '2',
pid: '1',
data: {
label: 'Mike Johnson',
positionName: 'CTO',
photo: 'https://i.pravatar.cc/150?img=3'
}
},
]
}
<All4One data={data} nodeTheme="modern" />Corporate Theme
Enterprise-ready styling with professional blues.
tsx
<All4One
data={data}
nodeTheme="corporate"
backgroundVariant="lines"
backgroundColor="#f8fafc"
/>Creating Your Own Demo
To create a StackBlitz demo:
- Go to stackblitz.com
- Create a new React + TypeScript project
- Install all4one:
npm install all4one - Copy an example above into your project
- Share the URL in your documentation
Required Dependencies
Ensure these peer dependencies are installed:
bash
npm install react react-dom @xyflow/react lucide-react zustand tailwindcss