Get Started
Introduction
Components
Accordion
Badge
Button
Card
Checkbox
Command
Dialog
Dropdown Menu
Input
Select
Switch
Table
Tabs
Toast
Tooltip
Forms
Introduction
Validation
Field Arrays

Components

Built-in components that ship with @barefootjs/xyflow. Drop them inside <Flow> (or compose into custom nodes / edges).

#Overview

@barefootjs/xyflow ships seven JSX-native components. Most pages only need <Flow> with a <Background> and <Controls>; the rest opt in for richer flows (minimap, custom nodes, custom edges).

#Everything together

Input
Transform
Validate
Output
1import { Flow, Background, Controls, MiniMap } from "@/components/ui/xyflow"23const initialNodes = [4  { id: "1", position: { x: 100, y: 100 }, data: { label: "Input" } },5  { id: "2", position: { x: 350, y:  50 }, data: { label: "Transform" } },6  { id: "3", position: { x: 350, y: 200 }, data: { label: "Validate" } },7  { id: "4", position: { x: 600, y: 125 }, data: { label: "Output" } },8]9const initialEdges = [10  { id: "e1-2", source: "1", target: "2" },11  { id: "e1-3", source: "1", target: "3" },12  { id: "e2-4", source: "2", target: "4" },13  { id: "e3-4", source: "3", target: "4" },14]1516<Flow nodes={initialNodes} edges={initialEdges}>17  <Background variant="dots" gap={20} />18  <Controls />19  <MiniMap pannable zoomable />20</Flow>

#<Flow>

The top-level container. Owns the store, the viewport transform, pan / zoom / drag subsystems, and the per-node measurement loop. Accepts nodes, edges, optional nodeTypes / edgeTypes maps, and any of the overlays below as children.

PropTypeDefaultDescription
nodesNodeBase[]-Initial node list. Each node needs `id`, `position: { x, y }`, and `data: {…}`.
edgesEdgeBase[]-Initial edge list. Each edge needs `id`, `source`, `target`.
nodeTypesRecord<string, NodeComponent>-Map of `node.type` → custom component for rendering.
edgeTypesRecord<string, EdgeComponent>-Map of `edge.type` → custom component for rendering.
childrenChild-Slot for `<Background>` / `<Controls>` / `<MiniMap>` overlays.

#<Background>

Pattern background that scales and pans with the viewport. Three variants — "dots", "lines", "cross" — plus gap / color tuning. The default color resolves to var(--border) so the pattern stays subtle in both light and dark themes.

#Variants

1import { Flow, Background } from "@/components/ui/xyflow"23export function Variants() {4  return (5    <div className="grid grid-cols-3 gap-4">6      <Flow nodes={[]} edges={[]}>7        <Background variant="dots" gap={20} />8      </Flow>9      <Flow nodes={[]} edges={[]}>10        <Background variant="lines" gap={30} />11      </Flow>12      <Flow nodes={[]} edges={[]}>13        <Background variant="cross" gap={32} />14      </Flow>15    </div>16  )17}
PropTypeDefaultDescription
variant"dots" | "lines" | "cross""dots"Pattern style.
gapnumber20Spacing between pattern repeats (in flow coordinates, scales with zoom).
colorstring"var(--border)"Pattern color. Defaults to the design-system border token so light / dark themes adapt.

#<Controls>

Zoom-in / zoom-out / fit-view / lock buttons. Each button is opt-out via the show* props; corner placement via position.

PropTypeDefaultDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right""bottom-left"Corner the controls float in.
showZoombooleantrueShow zoom-in / zoom-out buttons.
showFitViewbooleantrueShow fit-view button.
showInteractivebooleantrueShow the lock toggle.

#<MiniMap>

Overview map with a synced viewport rectangle. Pannable and zoomable by default; per-node colours via the nodeColor prop (string or function).

PropTypeDefaultDescription
pannablebooleantrueAllow drag-to-pan inside the minimap.
zoomablebooleantrueAllow wheel zoom on the minimap.
nodeColorstring | (node) => string"#e2e8f0"Per-node fill color in the minimap.

#<Handle>

Per-node connection point. Render inside a custom node body with a type ("source" | "target") and a position. Pass a stable id when a node has more than one handle on the same side so edges can target a specific connection point.

Source
Pipeline
Sink
PropTypeDefaultDescription
type"source" | "target""source"Whether this handle starts (`source`) or accepts (`target`) a connection.
positionPositionPosition.TopWhere on the node body the handle sits — `Top`, `Bottom`, `Left`, or `Right`.
nodeIdstring-Id of the parent node. Required so the connection layer can resolve handle bounds.
idstring-Optional handle id. Required when a node has more than one handle of the same type so edges can pin via `sourceHandle` / `targetHandle`.

#<NodeWrapper>

The transform / selection / measurement shell Flow mounts around every node. Most consumers don't reach for it directly — it shows up when you want the wrapper styling but need a fully manual rendering path instead of the nodeTypes map.

PropTypeDefaultDescription
nodeIdstring-Stable id of the node inside `store.nodeLookup()`.
childrenChild-Slot for the rendered node body.
ref(element: HTMLElement) => void-Optional ref callback for low-level imperative work; rarely needed.

#<SimpleEdge>

The default edge renderer. Reads the edge's type / animated / selected flags and draws a stroke alongside an invisible wide hit area for click selection.

PropTypeDefaultDescription
edgeIdstring-Stable id of the edge inside `store.edgeLookup()`. Used to read `type`, `selected`, `animated` reactively.