shadcn.io is an independent project built on shadcn/ui
Components
Free
Canvas for Solid
Nodes and edges for agent workflows: cards people drag and wire together on a board that pans and zooms. For Solid on Ark UI, with no flow library.
On this page10 sections
UI library: Ark UI
Canvas lays out an agent's workflow as cards on a dotted board, wired output to input by curved edges. People drag the cards, draw new connections and pan or zoom around, while the list of nodes and edges stays in your state. Each node is a Card, so a step can hold a model name, badges or a status line.
When the steps run in a straight line, a Plan or a Trace reads better. A canvas earns its space once the flow branches and joins again.
Installation
Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
<Canvasclass="h-96">
<CanvasEdgesource="plan"target="code"type="animated" />
<CanvasNodeclass="w-56"id="plan"x={0} y={0}>
<CanvasNodeHeader>
<CanvasNodeTitle>Plan</CanvasNodeTitle>
<CanvasNodeDescription>Splits the task into steps</CanvasNodeDescription>
</CanvasNodeHeader>
<CanvasNodeContent>4 steps</CanvasNodeContent>
</CanvasNode>
<CanvasNodeclass="w-56"id="code"x={300} y={40}>
<CanvasNodeHeader>
<CanvasNodeTitle>Code</CanvasNodeTitle>
<CanvasNodeDescription>Writes and tests each step</CanvasNodeDescription>
</CanvasNodeHeader>
<CanvasNodeContent>Running step 2</CanvasNodeContent>
</CanvasNode>
<CanvasControls />
</Canvas>
Give the canvas a height. It fills its parent, and the nodes inside are positioned rather than stacked, so they add no height of their own. Positions are in canvas units, with x counted from the inline start and y downward, and the view fits every node once they are measured, so where 0, 0 lands on screen doesn't matter.
Accessibility
The canvas is an application region named Canvas, so a screen reader passes keys straight to it, and a hidden line lists its shortcuts. Each node is a focusable group named by its CanvasNodeTitle, or by its id without one, so give every node a title. A node's handles are buttons: press its output, then another node's input, and the two connect without a drag. A polite live region announces each move and each new connection, and a waiting one that is cancelled. The zoom, fit view and lock buttons are labeled, and lock reports its state through aria-pressed. Edges are hidden from assistive technology, so if the shape of the flow matters, say it in text as well.
KeyAction
Tab
Moves focus to the canvas, then to each node, the buttons inside it and its output handle, and to the controls and panels, in the order you render them. An input handle joins the order only while a connection waits for one.
Arrow Up
On a node, moves it 10 units up. On the canvas itself, pans up.
Arrow Down
On a node, moves it 10 units down. On the canvas itself, pans down.
Arrow Left
On a node, moves it 10 units left. On the canvas itself, pans left.
Arrow Right
On a node, moves it 10 units right. On the canvas itself, pans right.
Shift
Held with an arrow key on a node, moves it 50 units instead of 10.
Enter
On a node, selects it, or clears the selection if it is already selected. On an output handle, starts a connection, or cancels the one it started. On a waiting input handle, connects there.
Space
Does what Enter does, on a node or a handle.
+
Zooms in around the middle of the view, from anywhere in the canvas except a text field.
-
Zooms out around the middle of the view.
0
Fits every node in view.
EscEscape
Clears the selection and stops a connection that is waiting for its input.
Demos
Node
Four steps of a retrieval flow: User Input and Context feed AI Agent, which answers in Response. The agent node uses every part, with its model as the description, a settings button in CanvasNodeAction, two tool badges and a footer with its timing. handles leaves User Input and Context with an output only and Response with an input only. Start here when you design what one step shows.
Edge
Four steps in a row, joined by one edge of each type. Start to Process is animated, a dot running from output to input for a link that is doing work right now. Process to Review is the plain default line, and Review to End is temporary, dashed, for a branch that hasn't run yet. With reduced motion turned on, the dot stays still at the middle of its edge.
Connection
Node A, Node B and Node C with no edges between them yet. Drag from one node's output handle and drop anywhere on another node, or press an output and then another node's input. onConnect receives the source and target ids, and the demo adds an edge unless it already has that one. Start from this when people build the flow themselves.
Saved layout
Three steps of an issue triage flow whose places live in your state: each CanvasNode takes position and hands every move back through onPositionChange. Drag a node or move it with the arrow keys, and Reset layout, enabled once something has moved, puts all three back. Start from this to save a layout with the flow or to undo a move.
Controls
Two nodes with CanvasControls laid out as a row centered along the bottom, set through orientation and position. Without those props the buttons stack in a column in the bottom start corner. Lock stops nodes from being moved, selected or connected, while the view still pans and zooms. Turn buttons off with showZoom, showFitView and showInteractive, and add your own as children.
Panel
One Workflow node under two panels: three icon buttons in the top start corner and a node count in the bottom end corner. A panel stays put while the view pans and zooms, and pressing it never starts a pan. position takes the four corners or the middle of the top or bottom edge. Keep panels small, since everything they cover is board.
Toolbar
Three nodes, each holding a CanvasToolbar that shows while its node is selected, with Node B selected from the start through defaultValue on the canvas. Click another node to move the toolbar there, or press Escape or click the board to hide it. Duplicate adds a copy below and to the side, and Delete removes the node from the list. The toolbar keeps its size at any zoom.
Migrating from AI SDK Elements
AI SDK Elements builds its canvas on React Flow, which is for React only, so there is nothing to migrate in Solid. Canvas has the same parts under the same names here, each node and edge a child of the canvas, and the demos above are the place to start.
FAQ
Does the Canvas need React Flow or another flow library?
No. Canvas has no flow library underneath. It drags and pans with pointer events, measures each node with a ResizeObserver so the edges follow it, and moves the whole view through three CSS variables.
What it leaves out is what a full graph editor adds: selecting and labeling edges, arrowheads, box selection, grid snapping and a minimap. If a workflow needs those, a dedicated flow library is the better fit.
How do I add nodes and edges to the Canvas in Solid?
Render them as children: a CanvasNode with an id, x and y for each node, and a CanvasEdge with the source and target ids for each edge. Keep both lists in state and render one child per entry, as the first demo on this page does with its Add node button. An edge whose node isn't there draws nothing.
The view fits itself once, when the first nodes are measured. A node added later can land outside the view until someone presses Fit view or the 0 key.
How do I save or set a Canvas node's position?
Listen with onPositionChange on the CanvasNode, which receives { x, y } on every step of a drag and every arrow key, and store it.
x and y only say where a node starts. The node copies them on its first render and ignores later changes, so a new x from your state won't move it. To place nodes from your own code, for a layout button or an undo, pass position and update it from that same callback, as the Saved layout demo does.
Can people connect Canvas nodes with the keyboard?
Yes. Every handle is a button. Tab to a node's output and press Enter, then tab to another node's input and press Enter again, and onConnect receives the source and target ids, as it does after a drag.
While a connection waits, the inputs light up and join the tab order, and a live region says which node it starts from. Escape stops it, and so does turning on the lock in CanvasControls. The Connection demo starts with no edges, to try both ways.
How do I change how the Canvas pans and zooms?
By default, dragging the board pans and the wheel or a trackpad pinch zooms around the pointer, between minZoom (0.25) and maxZoom (2). The wheel over a CanvasPanel or CanvasControls scrolls the panel or the page rather than the view. To make the wheel pan instead, with Ctrl or ⌘ held to zoom, set panOnScroll.
fitView, on by default, scales the view to show every node once they are measured, with fitViewPadding of room around them, and it never zooms in past 100%. Turn it off to start at the top inline-start corner at full size.
How do I know which Canvas node is selected?
The canvas keeps one selected node. onValueChange receives its id, or an empty string when the selection clears, and defaultValue picks the node selected from the start. Pass value as well to control it from your state.
The selected node draws a ring and shows its CanvasToolbar, as in the Toolbar demo. A click on the board or Escape clears it, and while the lock in CanvasControls is on, a click or Enter selects nothing.
Why does my Canvas show up short or empty?
Usually because nothing gives it a height. The canvas fills its parent, and its nodes are positioned inside it rather than stacked, so they add no height. Without a height from you it sits at its 16rem minimum, and the demos on this page set one on the canvas with a class.
Nodes also stay hidden until every one of them has been measured, so the view can fit them before anyone sees them move.
Does the Canvas work in right-to-left layouts?
Yes. x counts from the inline start, so with dir set to rtl on the canvas or on any element around it, the whole flow mirrors. The first node sits on the right, each node takes its input on the right side, and edges run leftward.
Panel positions are logical too, so top-start is the top right corner. The arrow keys still move a node and pan the view the way they point.
API Reference
Canvas
PropType
value?string
The selected node's id ("" for none), when you control it.
defaultValue?string
The node selected at first, by id.
Default
""
onValueChange?(value: string) → void
Called with the selected node's id, or "" when the selection clears.
Parameters
value – string
Returns
void
fitView?boolean
Scales and centers the view to show every node once they're measured.
Default
true
fitViewPadding?number
The room fitting leaves around the nodes, as a share of the view.
Called when someone connects a node's output to another node's input,
by dragging between their handles or choosing both with the keyboard.
Add the edge to your list to keep it.
Type
(connection: CanvasConnectionParams) → void
Parameters
connection – { source: string; target: string }
Returns
void
panOnScroll?boolean
The wheel pans the view; pinch, or the wheel with Ctrl or ⌘, zooms.
Without it the wheel zooms around the pointer.
Default
false
class?string
Merged with the part's classes.
CSS variableType
--canvas-dotstring
--canvas-gridstring
--canvas-xstring
--canvas-ystring
CanvasNode
<button>
PropType
position?object
The node's place, when you control it: move it in onPositionChange.
Called with the node's new place when a drag or a key moves it.
Type
(position: CanvasPosition) → void
Parameters
position – { x: number; y: number }
Returns
void
idstring
The node's id, unique in its canvas: edges name it as source or target.
draggable?boolean
Whether the node can be dragged and moved with the arrow keys.
Default
true
handles?object
The node's handles: target (its input, on the inline start) takes
edges in, source (its output, on the inline end) sends them out. Ark default: { source: true, target: true }.
Type
{ source: boolean; target: boolean }
Default
BOTH
size?"default" | "sm"
The size.
Type
"default" | "sm"
Default
"sm"
x?number
Where the node starts, from the canvas's inline start, in canvas units.
Default
0
y?number
Where the node starts, from the canvas's top, in canvas units.
Default
0
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
CSS variableType
--canvas-dirstring
--canvas-node-xstring
--canvas-node-ystring
--canvas-xstring
--canvas-ystring
--canvas-zoomstring
CanvasNodeHeader
data-slot="canvas-node-header"
PropType
description?string
The description of the card.
title?string
The title of the card.
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
CSS variableType
--card-spacingstring
CanvasNodeTitle
data-slot="canvas-node-title"
PropType
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
CanvasNodeDescription
data-slot="canvas-node-description"
PropType
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
CanvasNodeAction
data-slot="canvas-node-action"
PropType
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Forwarded to the part.
CanvasNodeContent
data-slot="canvas-node-content"
PropType
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
CSS variableType
--card-spacingstring
CanvasNodeFooter
data-slot="canvas-node-footer"
PropType
asChild?(props: ParentProps) => JSX.Element
Render your own element: a function that gets the part's props to spread on it.
Type
(props: ParentProps) => JSX.Element
class?string
Merged with the part's classes.
CanvasEdge
<svg>data-slot="canvas-edge"
PropType
sourcestring
The id of the node it starts from, at its output.
targetstring
The id of the node it ends at, at its input.
type?CanvasEdgeType
animated runs a dot along it, from source to target (it stops with
reduced motion); temporary dashes it, for a link not made yet.
Default
"default"
class?string
Merged with the part's classes.
AttributeType
data-type?string
Mirrors type.
CanvasConnection
<svg>data-slot="canvas-connection"
PropType
class?string
Merged with the part's classes.
CanvasPanel
<div>data-slot="canvas-panel"
PropType
position?CanvasPanelPosition
Where it sits over the canvas.
Default
"top-start"
class?string
Merged with the part's classes.
AttributeType
data-position?string
Mirrors position.
CanvasControls
<div>data-slot="canvas-controls"
PropType
orientation?"horizontal" | "vertical"
Which way the buttons run.
Type
"horizontal" | "vertical"
Default
"vertical"
position?CanvasPanelPosition
Where they sit over the canvas.
Default
"bottom-start"
showFitView?boolean
Shows the fit view button.
Default
true
showInteractive?boolean
Shows the lock button, which stops nodes from being moved, selected or
connected (the view still pans and zooms).
Default
true
showZoom?boolean
Shows the zoom in and zoom out buttons.
Default
true
class?string
Merged with the part's classes.
AttributeType
data-orientation?string
Mirrors orientation.
data-position?string
Mirrors position.
CanvasToolbar
<div>data-slot="canvas-toolbar"
PropType
isVisible?boolean
Shows it whether or not its node is selected (false hides it).