表示一组操作的菜单,在右键单击或长按时显示。
¥API Reference
此组件继承了 上下文菜单基础组件 的属性。
¥This component inherits props from the Context Menu primitive.
¥Root
包含上下文菜单的所有部分。
¥Contains all the parts of a context menu.
¥Trigger
封装将打开上下文菜单的元素。
¥Wraps the element that will open the context menu.
¥Content
上下文菜单打开时弹出的组件。
¥The component that pops out when the context menu is open.
¥Label
用于渲染标签。它无法通过方向键获得焦点。
¥Used to render a label. It won't be focusable using arrow keys.
¥Item
包含上下文菜单项的组件。
¥The component that contains the context 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.
打开子菜单的项目。必须在 ContextMenu.Sub
中渲染。
¥An item that opens a submenu. Must be rendered inside ContextMenu.Sub
.
在子菜单打开时弹出的组件。必须在 ContextMenu.Sub
中渲染。
¥The component that pops out when a submenu is open. Must be rendered inside ContextMenu.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 context 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 (i.e. a destructive action).
¥High-contrast
使用 highContrast
属性增加与背景的颜色对比度。
¥Use the highContrast
prop to increase color contrast with the background.