This project is a small Next.js sandbox for exploring React Flow and the new React Flow UI building blocks while staying within the shadcn design system. It renders a construction-electrician apprenticeship roadmap so you can experiment with nodes, custom layouts, and dialogs in a real app shell.
- Next.js / App Router for the runtime and routing
- Bun as the package manager/runtime (scripts in
package.jsonassume Bun) - @xyflow/react (formerly React Flow) for the graph canvas
- React Flow UI
BaseNodecomponents pulled via the shadcn generator - shadcn/ui (Radix primitives) for the dialog and buttons
- Tailwind CSS via the new
tailwindcssv4 pipeline already set up inglobals.css
bun install
bun run devThen open http://localhost:3000.
-
Install React Flow
bun add @xyflow/react
-
Fetch the React Flow UI base node
bun x shadcn@latest add https://ui.reactflow.dev/base-node
This generates
src/components/base-node.tsxwith theBaseNodelayout pieces you can reuse across nodes. -
Add shadcn dialog primitives
bun x shadcn@latest add dialog
Gives you
src/components/ui/dialog.tsxfor the Radix-powered modal. -
Create your custom node
- Define
RoadmapNodeDataand wrap the base node parts insrc/components/roadmap-node.tsx. - Register it in
nodeTypeswhen rendering<ReactFlow>.
- Define
-
Wire up state in
app/page.tsx- Use
useNodesState/useEdgesStateto manage the graph. - Attach
onNodeClickto open the shadcnDialogwith the stage’s details. - Optionally prefill positions, edges, and any styling you want to try.
- Use
-
Style tokens
src/app/globals.cssholds the blue/orange palette (both light/dark). Tweaks here propagate through shadcn + React Flow UI components.
bun run dev # start the dev server
bun run build # build for production
bun run start # run the production server
bun x tsc --noEmit # type-checkFeel free to swap in other React Flow UI components (badges, panels, minimap) or try different layouts—the README tracks the minimum steps needed to reproduce this playground from scratch.