Interactive Org Chart Prompts
AI prompts for interactive org chart from the LearnWithHasan AI Coding Building Blocks (UI Components).
Create a Basic Org Chart
Start here. Basic expand/collapse functionality From the Interactive Org Chart AI Coding Building Block.
Create an interactive org chart component for my app. I want users to see a hierarchy where they can click to expand and collapse branches.
Framework: [React, Vue, vanilla JS, etc.]
Library preference: [D3.js, React Flow, GoJS, or suggest one]
Requirements:
1. Display hierarchical data as connected boxes
2. Click a node to show/hide its children
3. Visual lines connecting parent to children
4. Start with top levels expanded, deeper levels collapsed
My data looks like this:
[paste your data structure, e.g., { id, name, title, children: [] }]
Keep it simple. I want to understand the basic pattern first. Show me:
- The component code
- How to pass in my data
- How to style the nodes (basic CSS)
I'm learning, so explain each part simply.
Add Zoom and Pan Navigation
Add navigation for large charts From the Interactive Org Chart AI Coding Building Block.
Add zoom and pan controls to my org chart so users can navigate large hierarchies. Framework: [React, Vue, vanilla JS, etc.] Current code: [paste your existing org chart code or describe it] Requirements: 1. Zoom in/out buttons (or pinch-to-zoom on mobile) 2. Pan by dragging the background (not nodes) 3. "Fit to screen" button to reset view 4. Smooth animations when zooming 5. Show current zoom level (optional) Also handle: - Minimum and maximum zoom limits (don't zoom to infinity!) - Mobile touch gestures - Keyboard shortcuts (+ and - keys) Keep the code simple. I want to understand how zoom/pan works with my existing chart. I'm learning, so explain each part simply.
Enable Drag to Reorganize
Let users rearrange the hierarchy From the Interactive Org Chart AI Coding Building Block.
Add drag-and-drop functionality to my org chart so users can reorganize the hierarchy. Framework: [React, Vue, vanilla JS, etc.] Current code: [paste your existing org chart code or describe it] Requirements: 1. Drag any node to move it 2. Drop on another node to make it a child of that node 3. Visual feedback while dragging (ghost image, drop zones) 4. Update the underlying data when reorganization completes 5. Undo button to revert last change Also consider: - Can any node be moved, or only certain ones? - What happens if you drag a parent onto its own child? (prevent cycles) - Save changes to backend? (show where to add API call) Keep it beginner-friendly. I want to understand the drag-and-drop pattern. I'm learning, so explain each part simply.
Convert to Mind Map Layout
For brainstorming and idea mapping From the Interactive Org Chart AI Coding Building Block.
Transform my org chart into a mind map layout where the central idea branches out in all directions. Framework: [React, Vue, vanilla JS, etc.] Current code: [paste your existing org chart code or describe it] Requirements: 1. Central node in the middle of the screen 2. Child nodes branch outward (not just downward like a tree) 3. Automatic layout so nodes don't overlap 4. Curved connecting lines for a natural look 5. Click to expand branches in any direction Also want: - Different colors for different branch depths - Ability to add new nodes by clicking "+" buttons - Auto-save as users add ideas This is for a brainstorming app where users build ideas visually. I'm learning, so explain each part simply.