logo

Ant Design Charts

  • Manual
  • Options
  • Examples
  • Productsantv logo arrow
  • 2.0.0
  • Component Overview
  • Common Configuration Statistical Charts
    • Chart composition
    • Component
      • 标题(Title)
      • Axis
      • Legend
      • Scrollbar
      • Slider
      • Tooltip
      • Label
    • Core
      • Color En
      • View
      • Data
        • overview
        • custom
        • ema
        • fetch
        • filter
        • fold
        • inline
        • join
        • kde
        • log
        • map
        • pick
        • rename
        • slice
        • sort
        • sortBy
      • Scale
        • overview
        • band
        • linear
        • log
        • ordinal
        • point
        • pow
        • quantile
        • quantize
        • sqrt
        • threshold
        • time
      • Transform
        • overview
        • bin
        • binX
        • diffY
        • dodgeX
        • flexX
        • group
        • groupColor
        • groupX
        • groupY
        • jitter
        • jitterX
        • jitterY
        • normalizeY
        • pack
        • sample
        • select
        • selectX
        • selectX
        • sortColor
        • sortX
        • sortY
        • stackEnter
        • stackY
        • symmetryY
      • Coordinate
        • overview
        • fisheye
        • parallel
        • polar
        • radial
        • theta
        • transpose
        • cartesian3D
      • 样式(Style)
      • Animate
        • overview
        • fadeIn
        • fadeOut
        • growInX
        • growInY
        • morphing
        • pathIn
        • scaleInX
        • scaleInY
        • scaleOutX
        • scaleOutY
        • waveIn
        • zoomIn
        • zoomOut
      • 状态(State)
      • Interaction
        • Overview
        • brushAxisHighlight
        • brushHighlight
        • brushXHighlight
        • brushYHighlight
        • brushFilter
        • brushXFilter
        • brushYFilter
        • chartIndex
        • elementHighlight
        • elementHighlightByColor
        • elementHighlightByX
        • elementSelect
        • elementSelectByColor
        • elementSelectByX
        • fisheye
        • legendFilter
        • legendHighlight
        • poptip
        • scrollbarFilter
        • sliderFilter
      • Composition
        • overview
        • facetCircle
        • facetRect
        • repeatMatrix
        • spaceFlex
        • spaceLayer
        • timingKeyframe
      • Theme
        • overview
        • Academy
        • classic
        • classicDark
      • event
    • Specal Plot
      • Area
      • Bar
      • CirclePacking
      • DualAxes
      • Gauge
      • Line
      • Rose
      • Sankey
      • Scatter
      • Sunburst
      • Treemap
      • Venn
      • WordCloud
      • Column
      • Pie
      • BidirectionalBar
      • Box
      • Bullet
      • Funnel
      • Heatmap
      • Histogram
      • Liquid
      • Radar
      • Stock
      • Tiny
      • Violin
      • Waterfall
      • RadialBar
  • Relation Graph Components
    • Overview
    • MindMap
    • Fishbone
    • IndentedTree
    • Dendrogram
    • OrganizationChart
    • FlowGraph
    • FlowDirectionGraph
    • NetworkGraph
    • FAQ

IndentedTree

Previous
Fishbone
Next
Dendrogram

Resources

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

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

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-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

An indented tree is used to represent hierarchical data, displaying parent-child relationships through indentation.

import { IndentedTree } from '@ant-design/graphs';

When to Use

  • File Directory Structure: Show hierarchy of directories and files in a file system.
  • Organizational Structure: Display the hierarchy of a company or team, and department relationships.
  • Navigation Menus: Show hierarchical navigation menus for websites or applications.
  • Category Hierarchy: Represent hierarchical relationships in classification systems, such as product categories or article categories.

Examples

API

For general graph properties, refer to: General Graph Properties

IndentedTree

PropertyDescriptionTypeDefault Value
dataThe datasetData-
labelFieldSpecifies the node label content
- Select a field from the data, and the corresponding field value will be used as the node label
- Dynamically generated: this function will be called with node data as a parameter, and its return value will be used as the node label
string | ((node: NodeData) => string)Node ID
typeSyntactic sugar for setting the display style. When node.component is set, it takes precedence'default' | 'linear' | 'boxed''default'
directionSyntactic sugar for setting the arrangement direction of nodes. When layout.direction is set, it takes precedence'left' | 'right' | 'alternate''right'
nodeMinWidthMinimum width of a node; if the text content is not enough, it will be centerednumber0
nodeMaxWidthMaximum width of a node; excess content will automatically wrap to the next linenumber300
defaultExpandLevelThe default expansion level; if not specified, all levels will be expandednumber-
layoutConfiguration for the indented tree layoutLayout-

Data

Two data formats are supported:

  1. (👍 Recommended) Tree data

Type Definition:

type TreeData = {
id: string;
children?: TreeData[];
[key: string]: unknown;
};

Example:

const data = {
id: 'root',
children: [
{
id: 'Child 1',
value: 10,
children: [
{ id: 'Sub 1-1', value: 5 },
{ id: 'Sub 1-2', value: 5 },
],
},
{
id: 'Child 2',
value: 20,
children: [
{ id: 'Sub 2-1', value: 10 },
{ id: 'Sub 2-2', value: 10 },
],
},
],
};
  1. Graph data. If the expand-collapse behavior is enabled, make sure the children field is included in the data.
const graphData = {
nodes: [
{ id: '1', data: { label: 'Node 1' }, children: ['2', '3'] },
{ id: '2', data: { label: 'Node 2' }, children: ['4'] },
{ id: '3', data: { label: 'Node 3' } },
{ id: '4', data: { label: 'Node 4' } },
],
edges: [
{ source: '1', target: '2' },
{ source: '1', target: '3' },
{ source: '2', target: '4' },
],
};

Layout

Indented tree layout, where the hierarchy of tree nodes is represented by horizontal indentation. Each element occupies a single line/column. Parameters are as follows:

PropertyDescriptionTypeDefault Value
typeLayout typestringindented
directionDirection of the tree layoutLR | RL | HLR
indentSpacing between columns. When the type is Number, the spacing is fixed; when the type is Function, the spacing between the node and the root node is the return value of the functionnumber | (node: NodeData) => string20
getWidthWidth of each node, effective when direction is H(node: NodeData) => numberDefault is node width
getHeightHeight of each node(node: NodeData) => numberDefault is node height
getSideSpecifies whether nodes are arranged on the left/right side of the root node. If set, all nodes will be on the same side of the root node, making direction = 'H' ineffective. If this parameter is a callback function, it can specify whether each node is on the left/right side of the root node(node: NodeData) => string-
dropCapWhether the first child node of each node is positioned on the next linebooleantrue
Basic Usage

A simple demonstration.

Styles

Use the type syntax sugar to apply preset styles: line style or boxed style.

Child Node Distribution

Set direction to alternate or left to distribute child nodes freely or to the left. If not set, the default is right (right distribution).

Custom Nodes

Customize nodes using node.component, which must be paired with node.size to take effect.

Expand/Collapse Child Nodes

Enable the expand/collapse behavior for child nodes by configuring the collapse-expand-react-node behavior. For detailed configuration instructions, refer to CollapseExpandReactNodeOptions. Additionally, configure defaultExpandLevel to control the default expansion level.

Set Branch Colors

assign-color-by-branch As a part of internal data processing, by adjusting the colors configuration, you can assign unique colors to different branches in order to distinguish the branch structure more clearly. Please refer to AssignColorByBranchOptions for detailed configuration instructions.

Preview