logo

X6

  • Tutorials
  • API
  • Examples
  • Q&A
  • Change Log
  • Productsantv logo arrow
  • 3.x
  • Introduction
  • Quickstart
  • Basic
    • Graph
    • Nodes
    • Edges
    • Ports
    • Interaction
    • Events
    • Data Serialization
    • Animation
  • Intermediate
    • Connection Points
    • Tools
    • Group
    • React Nodes
    • Vue Nodes
    • Angular Nodes
    • HTML Nodes
  • Plugin
    • Graphic Transformations
    • Snapline
    • Clipboard
    • Keyboard
    • History
    • Selection Box
    • Scroller
    • Dnd
    • Mini Map
    • Stencil
    • Export
  • Upgrade to 3.x
  • Developer Tools

Tools

Previous
Connection Points
Next
Group

Resource

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library
WeaveFox-AI Coding Assistant

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference
weavefoxWeaveFox-AI Developer Community

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-Interactive solution
weavefoxWeaveFox-AI Coding Assistant
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

This chapter mainly introduces knowledge related to tools. By reading, you can learn about

  • How to add tools for nodes or edges
  • Common tools built into X6

Using Tools

When creating nodes/edges, you can add tools through the tools option:

graph.addNode({
tools: [
{
name: 'button-remove', // Tool name
args: {
// Tool parameters
x: 10,
y: 10,
},
},
],
})
// If no parameters are needed, you can abbreviate as:
graph.addNode({
tools: ['button-remove'],
})
graph.addEdge({
source,
target,
vertices: [
{
x: 90,
y: 160,
},
{
x: 210,
y: 160,
},
],
tools: ['vertices', 'segments'],
})

After nodes/edges are created, you can call methods like hasTool(name), addTools(...), and removeTools() to add or remove tools.

Built-in Tools

Tools are widgets rendered on nodes/edges to enhance interactivity. We provide the following built-in tools for nodes and edges:

Nodes

  • button Renders a button at a specified position; supports custom click interactions.
  • button-remove Renders a delete button at a specified position; clicking deletes the node.
  • boundary Renders a rectangle around the node based on its bounding box. Note: visualization only; no interaction.

Edges

  • vertices Renders dots at path points. Drag to move; double-click to delete; click on the edge to add.
  • segments Renders a handle at each segment’s center; drag to adjust the adjacent path points.
  • boundary Renders a rectangle around the edge based on its bounding box. Note: visualization only; no interaction.
  • button Renders a button at a specified position; supports custom click interactions.
  • button-remove Renders a delete button at a specified position; clicking deletes the edge.
  • source-arrowhead and target-arrowhead Renders a shape (arrow by default) at the source/target terminal; drag to adjust the terminal.