跳至正文

Dropdown menu

水合前即可打开的操作菜单,支持丰富菜单项、选择项和子菜单。

浏览器
Chrome 151+
为什么是此版本?

CSS anchor positioning places this surface beside its trigger using position-anchor, and anchor(). Older Chrome versions may place the surface away from its trigger.

Firefox 151+
为什么是此版本?

CSS anchor positioning places this surface beside its trigger using position-anchor, and anchor(). Older Firefox versions may place the surface away from its trigger.

Safari 27+
为什么是此版本?

CSS anchor positioning places this surface beside its trigger using position-anchor, and anchor(). Older Safari versions may place the surface away from its trigger.

层级
2
压缩后大小
6.43 kB
强制布局预算
0 ms
axe 预算
0
支持 SSR
是
公开契约
测试环境

交互示例

Dropdown menu

简单菜单

复杂菜单

大型菜单

菜单栏

API

DropdownMenu.Bar

DropdownMenu.Root

DropdownMenu.Trigger

DropdownMenu.Content

DropdownMenu.Group

DropdownMenu.Label

DropdownMenu.Item

DropdownMenu.ItemIcon

DropdownMenu.ItemText

DropdownMenu.ItemDescription

DropdownMenu.Shortcut

DropdownMenu.ItemIndicator

DropdownMenu.Separator

DropdownMenu.CheckboxItem

DropdownMenu.RadioGroup

DropdownMenu.RadioItem

DropdownMenu.Sub

DropdownMenu.SubTrigger

DropdownMenu.SubContent

键盘

按键操作
Enter / Space / ↓打开菜单并聚焦第一项
↑ / ↓在各项之间移动焦点,到达首尾时循环
Escape关闭并将焦点返回触发器
Home / End跳至第一项或最后一项
a–z键入字符以跳至匹配项
→ / ←打开或关闭子菜单(RTL时方向相反)

无障碍

原生弹出层在水合前即可点击打开;增强键盘导航、键入跳转、复选框/单选框项,以及点击、悬停或方向键打开的子菜单在水合后启用。普通项默认关闭菜单,选择项保持菜单打开。定位使用原生CSS锚点,不处理碰撞。

样式钩子

data-partdata-statedata-disableddata-highlighteddata-sidedata-aligndata-checkeddata-indeterminate
本页由机器翻译,尚未经人工审核。