Menubar
v0.0.10
v0.0.10StableHeadlessStatelessAccessibleJSApache-2.0
Installation
mix mishka.ui.gen.headless menubar
Source
View Source
Parts & data attributes
Each part carries a stable data-part and a structural chelekom-menubar__* class you can target, plus paired-presence state for open/closed menu popups.
| Part | data-part | State / ARIA | Purpose |
|---|---|---|---|
| Root | - | role="menubar", aria-orientation, aria-disabled, data-orientation, data-modal, data-has-submenu-open, data-disabled | Carries the Menubar hook; reads orientation, loop, modal and disabled from its data attributes. |
| Menu | menu | - | Wraps one top-level trigger and its popup. |
| Trigger | trigger | role="menuitem", aria-haspopup, aria-expanded, aria-controls, aria-disabled, data-popup-open, data-pressed, data-disabled | The button that opens a menu; part of the roving tabindex. |
| Popup | popup | role="menu", aria-label, data-open, data-closed | The list of items for one menu. |
Accessibility
Follows the WAI-ARIA Menubar pattern: arrow keys move focus between top-level menus along the configured orientation (looping past the ends when enabled), Home/End jump to the first/last menu, Enter/Space or a cross-axis arrow opens a menu, Escape closes it, and once a menu is open, hovering or arrowing to another trigger switches the open menu. Arrow Up/Down move between items inside an open menu.
Attributes
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
id
|
string
| — | — | Yes | — |
orientation
|
string
|
horizontal
|
horizontalvertical
| No | — |
loop
|
boolean
|
true
| — | No | Loop arrow-key focus past the ends |
modal
|
boolean
|
true
| — | No | Mark the menubar modal (data-modal) |
disabled
|
boolean
|
false
| — | No | Disable the whole menubar (data-disabled) |
class
|
any
| — | — | No | — |
menu_class
|
any
| — | — | No | Extra classes for every top-level menu wrapper |
trigger_class
|
any
| — | — | No | Extra classes for every top-level trigger button |
popup_class
|
any
| — | — | No | Extra classes for every menu popup |
rest
|
global
| — | — | No | — |
Slots
| Name | Required | Description |
|---|---|---|
menu
| Yes | A top-level menu; its inner block holds the menu items |
Attributes of the menu slot
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
label
|
string
| — | — | Yes | — |
disabled
|
boolean
| — | — | No | Disable just this menu |
Options
Each option takes one or more of its values, separated by commas.
| Option | Values |
|---|---|
--type
|
menubar
|
--module
| A module name of your own |
What it generates
Functions
menubar
Helpers
None
Generated with it
None
Command
mix mishka.ui.gen.headless menubar