表示一组操作的菜单,由按钮触发。
¥API Reference
此组件继承了 下拉菜单基础组件 的属性。
¥This component inherits props from the Dropdown Menu primitive.
¥Root
包含下拉菜单的所有部分。
¥Contains all the parts of a dropdown menu.
¥Trigger
封装将打开下拉菜单的控件。
¥Wraps the control that will open the dropdown menu.
¥Trigger Icon
可选图标部分。
¥An optional icon part.
¥Content
下拉菜单打开时弹出的组件。
¥The component that pops out when the dropdown menu is open.
¥Label
用于渲染标签。它无法通过方向键获得焦点。
¥Used to render a label. It won't be focusable using arrow keys.
¥Item
包含下拉菜单项的组件。
¥The component that contains the dropdown menu items.
¥Group
用于对多个 Item
部分进行分组。
¥Used to group multiple Item
parts.
用于对多个 RadioItem
部分进行分组。
¥Used to group multiple RadioItem
parts.
可以像单选按钮一样控制和渲染的项目。
¥An item that can be controlled and rendered like a radio.
可以像复选框一样控制和渲染的项目。
¥An item that can be controlled and rendered like a checkbox.
包含子菜单的所有部分。
¥Contains all the parts of a submenu.
打开子菜单的项目。必须在 DropdownMenu.Sub
中渲染。
¥An item that opens a submenu. Must be rendered inside DropdownMenu.Sub
.
在子菜单打开时弹出的组件。必须在 DropdownMenu.Sub
中渲染。
¥The component that pops out when a submenu is open. Must be rendered inside DropdownMenu.Sub
.
¥Examples
¥Size
使用 size
属性控制大小。
¥Use the size
prop to control the size.
¥Variant
使用 variant
属性自定义下拉菜单的视觉样式。
¥Use the variant
prop to customize the visual style of the dropdown menu.
¥Color
使用 color
属性指定特定的 color。你还可以将 color
传递给特定项目,以便出于语义原因(例如,破坏性操作)进行覆盖。
¥Use the color
prop to assign a specific color. You can also pass color
to a specific item to override for semantic reasons (ie. destruction action).
¥High-contrast
使用 highContrast
属性增加与背景的颜色对比度。
¥Use the highContrast
prop to increase color contrast with the background.