"use client" import { NodeToolbar, Position } from "@xyflow/react" import type { ComponentProps } from "react" import { cn } from "@/lib/utils" type ToolbarProps = ComponentProps export const Toolbar = ({ className, ...props }: ToolbarProps) => ( ) import { Background, ReactFlow, ReactFlowProvider } from "@xyflow/react" import { CopyIcon, EditIcon, TrashIcon } from "lucide-react" import { Button } from "@/components/ui/button" import "@xyflow/react/dist/style.css" const ToolbarNode = ({ data, selected }: { data: { label: string }; selected: boolean }) => (
{data.label}
) const nodeTypes = { toolbar: ToolbarNode } const initialNodes = [ { id: "1", type: "toolbar", position: { x: 50, y: 50 }, data: { label: "Node A" } }, { id: "2", type: "toolbar", position: { x: 200, y: 120 }, data: { label: "Node B" } }, { id: "3", type: "toolbar", position: { x: 100, y: 200 }, data: { label: "Node C" } }, ] /** Demo component for preview */ export default function ToolbarDemo() { return (
Click a node to show its toolbar
) }