---
order: 5
title:
zh-CN: 连接线
en-US: Tree with line
---
## zh-CN
节点之间带连接线的树,常用于文件目录结构展示。使用 `showLine` 开启,可以用 `switcherIcon` 修改默认图标。
## en-US
Tree with connected line between nodes, turn on by `showLine`, customize the preseted icon by `switcherIcon`.
```tsx
import React, { useState } from 'react';
import { Tree, Switch } from 'antd';
import { CarryOutOutlined, FormOutlined } from '@ant-design/icons';
const treeData = [
{
title: 'parent 1',
key: '0-0',
icon: ,
children: [
{
title: 'parent 1-0',
key: '0-0-0',
icon: ,
children: [
{ title: 'leaf', key: '0-0-0-0', icon: },
{ title: 'leaf', key: '0-0-0-1', icon: },
{ title: 'leaf', key: '0-0-0-2', icon: },
],
},
{
title: 'parent 1-1',
key: '0-0-1',
icon: ,
children: [{ title: 'leaf', key: '0-0-1-0', icon: }],
},
{
title: 'parent 1-2',
key: '0-0-2',
icon: ,
children: [
{ title: 'leaf', key: '0-0-2-0', icon: },
{
title: 'leaf',
key: '0-0-2-1',
icon: ,
switcherIcon: ,
},
],
},
],
},
];
const Demo: React.FC<{}> = () => {
const [showLine, setShowLine] = useState(true);
const [showIcon, setShowIcon] = useState(false);
const onSelect = (selectedKeys, info) => {
console.log('selected', selectedKeys, info);
};
return (
);
};
ReactDOM.render(, mountNode);
```