For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/zh/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/zh/llms-full.txt, and this page is available as Markdown at https://rickyshin93.github.io/tao-ui/zh/components/tree.md.
v0.0.57
  • 简体中文
  • Tree

    数据展示@rockshin/tao-ui

    通过层级展开、勾选、异步子节点、拖拽和虚拟滚动浏览树形数据。

    每个示例都可以独立复制运行。带设备预览的示例可通过工具栏切换桌面与手机宽度。

    示例

    展开与选择

    为节点提供稳定 key。方向键浏览节点,Enter 选择当前节点。

    Workspace
    TSX

    受控勾选

    勾选父节点会联动可用的后代节点,将回调中的 keys 存入状态。

    Workspace
    Design
    tokens.json
    Engineering
    README.md
    Checked: tokens
    TSX

    独立勾选与禁用

    checkStrictly 让父子节点独立勾选;disabled 禁用节点,disableCheckbox 只禁用勾选。

    Independent parent
    Selectable child
    Checkbox disabled
    Entire node disabled
    TSX

    目录树

    DirectoryTree 提供文件夹和文件图标;multiple 开启后支持修饰键与范围选择。

    Workspace
    Design
    tokens.json
    Engineering
    README.md
    TSX

    自定义标题与语义样式

    titleRender 装饰节点内容而不改变 key;语义样式作用于实际标题部件。

    Workspace
    Design
    tokens.jsonfile
    Engineering
    README.mdfile
    TSX

    按需加载子节点

    此本地示例模拟延迟结果,更新父节点后完成 loadData。

    TSX

    虚拟列表与定位

    设置有限高度启用虚拟渲染;ref 可以定位到当前视口外的节点。

    Document 1
    Document 2
    Document 3
    Document 4
    Document 5
    Document 6
    Document 7
    Document 8
    TSX

    拖拽调整顺序

    示例只允许在行间放置并保存新顺序;嵌套移动可以使用同一 onDrop 契约。

    Inbox
    In review
    Published
    TSX

    窄屏树形面板

    在手机预览中展开、勾选节点,列表在有限高度内滚动。

    390 × 640
    TSX

    API

    BasicDataNode

    For fieldNames, we provides a abstract interface

    属性说明类型默认值

    DirectoryTree

    属性说明类型默认值
    rootStyle@deprecated Use styles.root.CSSProperties | undefined-
    filterAntTreeNode@deprecated Use filterTreeNode.((treeNode: EventDataNode<T>) => boolean) | undefined-

    Tree

    属性说明类型默认值
    rootStyle@deprecated Use styles.root.CSSProperties | undefined-
    filterAntTreeNode@deprecated Use filterTreeNode.((treeNode: EventDataNode<T>) => boolean) | undefined-