相关 [[下拉菜单 Dropdown]] ## 概念 用于选择值的表单输入:折叠时显示当前选择的选项,展开时显示预定义选项的可滚动列表,供用户选择。 - [Select - Lightning Design System](https://www.lightningdesignsystem.com/components/select/) - Select element presents a menu of options. - The HTML `<select>` element presents a menu of options. The options within the menu are represented by `<option>` elements that you can group with `<optgroup>` elements. You can pre-select options for the user. - [[Atlassian Design System#^018209]] - Select allows users to make a single selection or multiple selections from a list of options. - [[Ant Design]] - Select component to select value from options. - [Select – Carbon Design System](https://carbondesignsystem.com/components/select/usage/) - The select component allows users to choose one option from a list. It is **used in forms for users to submit data**. - Select VS Dropdown? - While the select and dropdown components look similar, they have different functions. - Use the select component inside a form where users are selecting from a list of options and submitting data. - Use the dropdown component to filter or sort content on a page. - 这两个组件之间的另一个重要区别是底层代码。选择组件的外观将由正在使用的浏览器决定,而下拉组件可以根据需要设置样式。 ## 最佳实践 - [[Ant Design]] - 弹出一个下拉菜单给用户选择操作,用于代替原生的选择器,或者需要一个更优雅的多选器时。 - 当选项少时(少于 5 项),建议直接将选项平铺,使用 [[单选 Radio]] 是更好的选择。 - 池 - 如果下拉选项过多,例如选择语言,和字体,最好有一个搜索框,不然找起来真的很费劲。