设计
设计指南
设计原则
样式指南
设计资源
Klein - Figma
Klein Font
官方图标库
开发
开发文档
React
Vue Web
敬请期待
开发资源
GitHub 代码仓库
生态产品
生态产品
Orion Fonts
敬请期待
Orio Market
敬请期待
Klein Pro
敬请期待
Klein Editor
敬请期待

树选择 TreeSelect

树型选择控件,可以对树形结构数据进行选择。

基础示例

树型选择控件。

受控

组件受控。

支持多选

多选的树选择。

支持勾选

使用勾选框实现多选功能。

数据加载

动态加载节点数据。

支持虚拟滚动

适用于大数据量的情况。

Tree.Select

参数说明类型默认值
treeData数据TreeSelectNode[]-
multiple支持多选(当设置 treeCheckable 时自动变为 true)booleanfalse
treeAutoExpandParent自动展开父节点 *booleantrue
treeSearchValue搜索值 *string-
treeCheckable显示 Checkboxbooleanfalse
treeDefaultExpandAll默认展开所有树节点boolean-
treeDefaultExpandedKeys默认展开的树节点Key[]-
treeExpandedKeys设置展开的树节点Key[]-
treeIcon自定义树节点图标ReactNode-
treeLine是否展示线条样式boolean-
treeSwitcherIcon树节点切换iconstring-
onTreeExpand树节点展开时触发((expandedKeys: Key[], info: { expand: boolean; node: TreeNode; }) => void)-
loadData按需加载数据((node: TreeNode, level: number) => Promise<any>)-
treeNodePlaceholder格外的select的options,数据按需加载并且需要搜索时使用number-
removeIcon自定义的多选框清除图标ReactNode-
wSize内置5种select宽度(分别对应96,200,304,408,512)"xs"-
size按钮大小"large"-
loading加载状态控制boolean-
showArrow是否显示下拉小箭头boolean-
showSearch使单选模式可搜索boolean-
listHeight设置弹窗滚动高度number-
dropdownClassName下拉菜单的 className 属性string-
suffixIcon自定义的选择框后缀图标ReactNode-
maxTagCount最多显示多少个 tag,响应式模式会对性能产生损耗number-
maxTagTextLength最大显示的 tag 文本长度number-
dropdownStyle下拉菜单的 style 属性CSSProperties-
dropdownRender自定义下拉框内容((menu: ReactNode) => ReactNode)-
tagRender自定义 tag 内容 render((props: TagRenderProps, originNode: ReactNode) => ReactElement<any, string-
virtual设置 false 时关闭虚拟滚动booleantrue
value指定当前选中的条目string-
defaultValue指定默认选中的条目string-
bordered是否有边框boolean-
dropdownMatchSelectWidth下拉菜单和选择器同宽默认将设置 min-width,当值小于选择框宽度时会被忽略false 时会关闭虚拟滚动numbertrue
onClear清除内容时回调(() => void)-
onDeselect取消选中时调用,参数为选中项的 value (或 key) 值,仅在 multiple 或 tags 模式下生效((value: string-
open是否展开下拉菜单boolean-
allowClear支持清除boolean-
autoFocus默认获取焦点boolean-
defaultOpen是否默认展开下拉菜单boolean-
disabled禁用状态控制boolean-
getPopupContainer提示信息挂载点,默认挂载到 body 上((node?: any) => HTMLElement)-
notFoundContent当下拉列表为空时显示的内容ReactNode-
placeholderplaceholderstring-
className自定义classNamestring-
style自定义styleCSSProperties-
onChange选中 option,或 input 的 value 变化时,调用此函数((value: any, option?: any) => void)-
onDropdownVisibleChange展开下拉菜单的回调((open: boolean) => void)-
onSearch文本框值变化时回调((value: string) => void)-
onSelect被选中时调用,参数为选中项的 value (或 key) 值((value?: any, option?: any) => void)-

贡献者