Overview
Canvas nodes are the building blocks of an Obsidian canvas. There are four types of nodes: file nodes, text nodes, link nodes, and group nodes. All node types share common positional properties defined in the baseCanvasNodeData interface.
Base Interface
Base Properties
The unique identifier for this node. Must be unique within the canvas.
The horizontal position of the node’s top-left corner in canvas coordinates.
The vertical position of the node’s top-left corner in canvas coordinates.
The width of the node in pixels.
The height of the node in pixels.
The color of this node. Can be a number (like
"1") representing one of the currently 6 supported colors, or a custom color using the hex format "#FFFFFF".Supports arbitrary additional keys for forward compatibility.
Node Types
CanvasFileData
A node that links to a file located somewhere in the vault.Must be
"file" for file nodes.The path to the file in the vault, relative to the vault root.Example:
"Notes/MyNote.md"An optional subpath which links to a heading or a block within the file. Always starts with
#.Examples:"#Heading"- Links to a heading"#^blockid"- Links to a specific block
CanvasTextData
A node that contains plaintext content.Must be
"text" for text nodes.The text content of the node. Can include Markdown formatting.
CanvasLinkData
A node that links to an external resource (URL).Must be
"link" for link nodes.The URL to the external resource.Example:
"https://obsidian.md"CanvasGroupData
A node that represents a container group for organizing other nodes.Must be
"group" for group nodes.Optional label to display on top of the group.
Optional background image. Stores the path to the image file in the vault.Example:
"Images/background.png"Optional background image rendering style. Defaults to
"cover".Possible values:"cover"- Scale the image to cover the entire group"ratio"- Maintain aspect ratio"repeat"- Tile the image
Examples
File Node
Text Node
Link Node
Group Node
Type Union
TheAllCanvasNodeData type is a union of all node types:
type property.
Usage Example
Related Types
- CanvasData - The top-level canvas file structure
- CanvasEdgeData - Interface for connections between nodes
CanvasColor- Type for color encodingBackgroundStyle- Type for group background rendering