下拉菜单
用途
A3S UI 下拉菜单相对于 .dropdown-menu 包装器内联定位。这与 shadcn/ui 的门户 Base UI 实现不同,但保持标记无依赖,并与 A3S UI 的当前弹出框/选择定位模型相匹配。
Add your dropdown menu HTML
HTML 结构
<div class="dropdown-menu">Relative wrapper for the trigger and inline menu content.
<button aria-haspopup="menu" aria-expanded="false">- Trigger button. The script toggles
aria-expandedand manages keyboard navigation. <div data-popover aria-hidden="true">Menu content popover. Set
data-side="top|right|bottom|left|inline-start|inline-end"anddata-align="start|center|end"to control placement.<div role="menu">Container for menu items, groups, labels, and separators.
<div role="group" aria-labelledby="{ HEADING_ID }">Optional- Groups related menu items.
<div role="heading" id="{ HEADING_ID }">Optional- Group heading/label.
<div role="menuitem">- Standard action item. Use
aria-disabled="true"for disabled items. <div role="menuitemcheckbox" aria-checked="true">- Checkbox-style item. Add a child with
data-indicatorfor the checked icon. <div role="menuitemradio" aria-checked="true">- Radio-style item. Add a child with
data-indicatorfor the selected icon. <kbd>Optional- Shortcut hint aligned to the inline end of the item.
<hr role="separator">Optional- Separator between groups or options.
JavaScript API
示例
基本
快捷键
图标
复选框
复选框图标
无线电组
无线电图标
破坏性
头像
RTL
下拉菜单支持文档方向。在下拉根或父元素上设置 dir="rtl"。尽可能使用逻辑对齐数据属性。