Elements

参考

列表框 Listbox

Listbox:列表框。行内容保持低调,只有选中行使用 primary 平铺填充。部件:Root、Label、Input、Content、Empty、Item、ItemText、ItemIndicator、ItemGroup、ItemGroupLabel、ValueText;collection 位于共享 collection 模块。

Label · Input · Item · ItemText · ItemIndicator · ItemGroup · ItemGroupLabel · Content · Root · ValueText

#Content

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#Empty

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#Input

属性类型默认值描述
autoHighlightboolean | undefinedfalse输入时是否自动高亮选项
keyboardPriority"caret" | "navigate" | undefined"caret"输入框键盘事件的优先级:caret 保留原生文本编辑行为,navigate 把支持的按键转发给列表框导航

#ItemContext

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#ItemGroupLabel

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#ItemGroup

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#ItemIndicator

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#ItemText

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#Item

属性类型默认值描述
highlightOnHoverboolean | undefined悬停时是否高亮选项
itemT要渲染的列表选项

#Label

纯造型的部件——自身没有属性,沿用部件结构的共享样式。

#Root

属性类型默认值描述
sizeString as PropType<"sm" | "md" | "lg">"md"行和筛选字段使用的尺寸档位
collectionListCollection<T>选项集合
defaultHighlightedValuestring打开时默认高亮项的值;适合不需要受控高亮值的场景
defaultValuestring[][]列表框的初始默认值;适合不需要受控值的场景
deselectableboolean是否禁止空选择
disabledboolean是否禁用列表框
disallowSelectAllboolean按下 meta+a 时是否禁止全选
highlightedValuestring高亮项的受控值
idstring组件内部状态机的唯一标识
idsPartial<{ root: string; content: string; label: string; item(id: string | number): string; itemGroup(id: string | number): string; itemGroupLabel(id: string | number): string; }>列表框各元素的 id,便于组合使用
loopFocusbooleanfalse键盘导航是否在选项间循环
modelValuestring[]列表框的模型值
orientation'horizontal' | 'vertical'"horizontal"列表框的排列方向
scrollToIndexFn(details: listbox.ScrollToIndexDetails) => void滚动到指定索引的函数
selectionModelistbox.SelectionMode"single"列表框的选择行为:single 只能选择一个选项,multiple 不按修饰键也能选择多个,extended 需要配合修饰键选择多个
selectOnHighlightboolean选项高亮时是否选中
typeaheadboolean是否启用输入即查找
事件载荷
selectdetails: SelectionDetails
valueChangedetails: ValueChangeDetails<T>
update:modelValuevalue: string[]
highlightChangedetails: HighlightChangeDetails<T>
update:highlightedValuevalue: string | null

#ValueText

属性类型默认值描述
placeholderstring—