Menubar

由菜单家族构建的桌面风格菜单栏:只占一个 Tab 停靠点,方向键在菜单之间及相邻菜单中移动,一旦有菜单打开,悬停即可切换。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 暂不可用

用法

导入

ts
import {
  SoneMenubarDirective,
  SoneMenubarTriggerDirective,
} from "@surface-one/angular/menubar";

API 参考

SoneMenubarDirective指令

`[soneMenubar]` — a horizontal bar of menus (spartan/ui Menubar, WAI-ARIA menubar pattern): `role="menubar"`, one Tab stop (roving tabindex) over its `soneMenubarTrigger`s, ArrowLeft / ArrowRight, Home and End between them. Name it with `aria-label`.

选择器
[soneMenubar]
导出为
soneMenubar

SoneMenubarTriggerDirective指令

`[soneMenubarTrigger]` — a top-level item of a `soneMenubar` (`role="menuitem"`, `aria-haspopup="menu"`, `aria-expanded`) that opens a `[soneMenu]` — the menu family's panel, items, submenus and keys. Enter, Space and ArrowDown open it on the first item, ArrowUp on the last; inside it ArrowLeft / ArrowRight close it and open the neighbouring menu; once a menu is open, hovering another trigger switches to it.

选择器
[soneMenubarTrigger]
导出为
soneMenubarTrigger
输入
名称类型 默认值
side

The side of the trigger the panel opens on; it flips when that side lacks room.

FloatingSide"bottom"
align

Alignment along the trigger's edge.

FloatingAlign"start"
offset

Gap between the trigger and the panel, in px.

number4
open双向

Shown or not — `[(open)]`.

booleanfalse
keepOpenOnOutsideClick

Keep the panel open on a click outside it (Escape still closes it).

booleanfalse
soneMenuTriggerSoneOverlayContent | nullnull
soneMenubarTriggerSoneOverlayContent | nullnull