@nanahoshi/mona-ui 0.25.1 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/README.md +2 -0
  2. package/command/package.json +4 -0
  3. package/docs/auto-complete.md +733 -0
  4. package/docs/avatar.md +220 -0
  5. package/docs/breadcrumb.md +320 -0
  6. package/docs/button-group.md +392 -0
  7. package/docs/button.md +256 -0
  8. package/docs/calendar.md +515 -0
  9. package/docs/card.md +292 -0
  10. package/docs/chart.md +4058 -0
  11. package/docs/checkbox.md +374 -0
  12. package/docs/chip.md +339 -0
  13. package/docs/circular-progress-bar.md +287 -0
  14. package/docs/collapsible.md +308 -0
  15. package/docs/color-gradient.md +336 -0
  16. package/docs/color-palette.md +317 -0
  17. package/docs/color-picker.md +387 -0
  18. package/docs/combo-box.md +764 -0
  19. package/docs/command.md +582 -0
  20. package/docs/contextmenu.md +530 -0
  21. package/docs/date-picker.md +251 -0
  22. package/docs/datetime-picker.md +284 -0
  23. package/docs/decimal-textbox.md +260 -0
  24. package/docs/dialog.md +822 -0
  25. package/docs/dropdown-button.md +507 -0
  26. package/docs/dropdown-list.md +779 -0
  27. package/docs/editor.md +374 -0
  28. package/docs/expansion-panel.md +348 -0
  29. package/docs/fieldset.md +217 -0
  30. package/docs/forms.md +162 -0
  31. package/docs/grid.md +2053 -0
  32. package/docs/input.md +197 -0
  33. package/docs/installation.md +54 -0
  34. package/docs/introduction.md +46 -0
  35. package/docs/label.md +340 -0
  36. package/docs/list-box.md +637 -0
  37. package/docs/list-view.md +584 -0
  38. package/docs/menubar.md +559 -0
  39. package/docs/multi-select.md +765 -0
  40. package/docs/notification.md +460 -0
  41. package/docs/numeric-textbox.md +301 -0
  42. package/docs/otp-input.md +539 -0
  43. package/docs/pager.md +513 -0
  44. package/docs/placeholder.md +176 -0
  45. package/docs/popover.md +423 -0
  46. package/docs/popup-menu.md +658 -0
  47. package/docs/popup.md +617 -0
  48. package/docs/progress-bar.md +368 -0
  49. package/docs/radio-button.md +451 -0
  50. package/docs/range-slider.md +367 -0
  51. package/docs/rating.md +518 -0
  52. package/docs/scroll-view.md +375 -0
  53. package/docs/segmented.md +434 -0
  54. package/docs/sheet.md +348 -0
  55. package/docs/sidebar.md +1126 -0
  56. package/docs/skeleton.md +181 -0
  57. package/docs/slider.md +423 -0
  58. package/docs/spinner.md +370 -0
  59. package/docs/split-button.md +522 -0
  60. package/docs/splitter.md +342 -0
  61. package/docs/stepper.md +539 -0
  62. package/docs/switch.md +340 -0
  63. package/docs/tabs.md +542 -0
  64. package/docs/textarea.md +196 -0
  65. package/docs/textbox.md +332 -0
  66. package/docs/theming.md +403 -0
  67. package/docs/time-picker.md +254 -0
  68. package/docs/tooltip-directive.md +340 -0
  69. package/docs/tooltip.md +321 -0
  70. package/docs/tree-view.md +1018 -0
  71. package/docs/window.md +663 -0
  72. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  73. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  74. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  75. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  76. package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
  77. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  78. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  80. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  81. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  82. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  83. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  84. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  85. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  86. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  87. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  88. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  89. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  90. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  91. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  92. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  93. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  97. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  98. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  99. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  100. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  102. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  103. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  104. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  105. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  118. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  119. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  120. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  121. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  122. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  123. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  124. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  125. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  126. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  127. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  128. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  129. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  130. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  131. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  132. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  133. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  134. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  135. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  136. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  137. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  138. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  139. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  140. package/i18n/catalogs/en-US.messages.json +10 -0
  141. package/internal/popup-menu/package.json +4 -0
  142. package/llms.txt +123 -0
  143. package/locales/ar-sa/ar-sa.messages.json +10 -0
  144. package/locales/de-de/de-de.messages.json +10 -0
  145. package/locales/es-es/es-es.messages.json +10 -0
  146. package/locales/fr-fr/fr-fr.messages.json +10 -0
  147. package/locales/id-id/id-id.messages.json +10 -0
  148. package/locales/it-it/it-it.messages.json +10 -0
  149. package/locales/ja-jp/ja-jp.messages.json +10 -0
  150. package/locales/ko-kr/ko-kr.messages.json +10 -0
  151. package/locales/pt-br/pt-br.messages.json +10 -0
  152. package/locales/ru-ru/ru-ru.messages.json +10 -0
  153. package/locales/tr-tr/tr-tr.messages.json +10 -0
  154. package/locales/zh-cn/zh-cn.messages.json +10 -0
  155. package/locales/zh-tw/zh-tw.messages.json +10 -0
  156. package/package.json +9 -1
  157. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  158. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  159. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  160. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  161. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  162. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  163. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  164. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  165. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  166. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  167. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  168. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  169. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  170. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  171. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  172. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  173. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  174. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  175. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  176. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  177. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  178. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  179. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  180. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  181. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  182. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  183. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  184. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  185. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  186. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  187. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  188. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  189. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  190. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  191. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  192. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  201. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  202. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  203. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  204. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  205. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  206. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  207. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  208. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  209. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  210. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  211. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  212. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  213. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  214. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  215. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  216. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  217. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  218. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  219. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  220. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  221. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  222. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,559 @@
1
+ # Menubar
2
+
3
+ > A persistent horizontal bar of top-level menus.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/menubar`
6
+
7
+ **Selectors:** `mona-menubar` · `mona-menu` · `mona-menu-item` · `mona-menu-checkbox-item` · `mona-menu-radio-group` · `mona-menu-radio-item` · `mona-menu-group` · `mona-menu-separator`
8
+
9
+ `MenubarComponent` renders a persistent, horizontal bar of top-level menus, each opening a popup menu built from content-projected menu item components.
10
+
11
+ ## Overview
12
+
13
+ `MenubarComponent` (`mona-menubar`) renders a horizontal `role="menubar"` bar. Each top-level `mona-menu` opens its own popup menu on click, built from content-projected menu item components nested inside it.
14
+
15
+ Menu content is built the same way as `ContextMenuComponent`: `mona-menu-item`, `mona-menu-checkbox-item`, `mona-menu-radio-group`/`mona-menu-radio-item`, `mona-menu-group`, and `mona-menu-separator`, nested inside a `mona-menu`. Nesting items inside another item creates a submenu.
16
+
17
+ **Use `MenubarComponent` when you need to:**
18
+
19
+ - Provide a persistent, always-visible bar of top-level menus (File, Edit, View, …) at the top of an application or a document-style view
20
+ - Let users switch between open menus by moving the pointer across the bar, the way a desktop application menubar behaves
21
+
22
+ **Use a closely related Mona UI component instead when:**
23
+
24
+ - The menu should only appear on right-click or a keyboard shortcut on a specific target element — use `ContextMenuComponent`.
25
+ - The menu should open from a single dedicated button rather than a row of persistent top-level menus — use `DropdownButtonComponent`.
26
+ - You need a lower-level popup menu with a configurable trigger event, anchor element, or open/close outputs for a single menu — use `PopupMenuComponent` directly. `MenubarComponent` creates one `PopupMenuComponent` per top-level `mona-menu` internally and does not expose its `anchor`/`offset`/`precise` inputs.
27
+
28
+ ## Import & Quick Start
29
+
30
+ ```typescript
31
+ import { MenubarComponent, MenuComponent, MenuItemComponent } from "@nanahoshi/mona-ui/menubar";
32
+ ```
33
+
34
+ Add the components you need to your standalone component's `imports` array.
35
+
36
+ **Minimal example:**
37
+
38
+ ```html
39
+ <mona-menubar (menuItemClick)="onMenuClick($event)">
40
+ <mona-menu text="File">
41
+ <mona-menu-item label="New"></mona-menu-item>
42
+ <mona-menu-item label="Open"></mona-menu-item>
43
+ <mona-menu-separator></mona-menu-separator>
44
+ <mona-menu-item label="Exit"></mona-menu-item>
45
+ </mona-menu>
46
+ <mona-menu text="Edit">
47
+ <mona-menu-item label="Undo"></mona-menu-item>
48
+ <mona-menu-item label="Redo"></mona-menu-item>
49
+ </mona-menu>
50
+ </mona-menubar>
51
+ ```
52
+
53
+ ```typescript
54
+ import type { MenuItemClickEvent } from "@nanahoshi/mona-ui/menubar";
55
+
56
+ protected onMenuClick(event: MenuItemClickEvent): void { /* ... */ }
57
+ ```
58
+
59
+ ## Anatomy
60
+
61
+ ### Content projection
62
+
63
+ ```
64
+ mona-menubar
65
+ └── mona-menu — a top-level menu; text is set via the `text` input
66
+ ├── mona-menu-item — a clickable item; project more items inside it for a submenu
67
+ ├── mona-menu-checkbox-item — a toggle item
68
+ ├── mona-menu-radio-group — mutually exclusive choices
69
+ │ └── mona-menu-radio-item
70
+ ├── mona-menu-group — a titled section of items
71
+ │ └── mona-menu-item
72
+ └── mona-menu-separator — a horizontal divider
73
+ ```
74
+
75
+ Alternatively, a `mona-menu` can be given an `items` collection directly (see the API section) instead of projecting item components. When `items` is non-empty, it takes precedence over projected content.
76
+
77
+ ### Template directives
78
+
79
+ Two directives customize a top-level menu itself (`monaMenuIconTemplate`, `monaMenuTextTemplate`); the rest customize the items inside a menu's popup, the same way `ContextMenuComponent`'s template directives do.
80
+
81
+ | Directive attribute | Scope | Template context |
82
+ |--------------------------------|----------------|-----------------------------------------------------------------------------------|
83
+ | `monaMenuGroupTemplate` | Global / Group | `$implicit: string` — the group title |
84
+ | `monaMenuIconTemplate` | Global / Menu | `$implicit: string` — the menu's `text`, `items` — the menu's resolved items |
85
+ | `monaMenuItemIconTemplate` | Global / Item | `$implicit` — the menu item (`label`, `disabled`, …); see API for the type caveat |
86
+ | `monaMenuItemShortcutTemplate` | Global / Item | `$implicit` — the menu item, as above |
87
+ | `monaMenuItemTextTemplate` | Global / Item | `$implicit` — the menu item, as above |
88
+ | `monaMenuTextTemplate` | Global / Menu | `$implicit: string` — the menu's `text`, `items` — the menu's resolved items |
89
+
90
+ Placed directly inside `<mona-menubar>`, a directive applies to every menu (or every item, for the item-level ones). Placed inside a specific `mona-menu`, `mona-menu-item`, or `mona-menu-group`, it overrides the global template for that node only.
91
+
92
+ **Custom icon for one top-level menu:**
93
+
94
+ ```html
95
+ <mona-menubar>
96
+ <mona-menu text="File">
97
+ <ng-template monaMenuIconTemplate>
98
+ <svg lucideFile [size]="14"></svg>
99
+ </ng-template>
100
+ <mona-menu-item label="New"></mona-menu-item>
101
+ </mona-menu>
102
+ </mona-menubar>
103
+ ```
104
+
105
+ **Custom text for every top-level menu:**
106
+
107
+ ```html
108
+ <mona-menubar>
109
+ <ng-template monaMenuTextTemplate let-text let-items="items">
110
+ <span>{{ text }} ({{ items.length }})</span>
111
+ </ng-template>
112
+ <mona-menu text="File">
113
+ <mona-menu-item label="New"></mona-menu-item>
114
+ </mona-menu>
115
+ </mona-menubar>
116
+ ```
117
+
118
+ **Custom text for one item:**
119
+
120
+ ```html
121
+ <mona-menubar>
122
+ <mona-menu text="File">
123
+ <mona-menu-item label="Delete">
124
+ <ng-template monaMenuItemTextTemplate let-item>
125
+ <span class="text-destructive">{{ item.label }}</span>
126
+ </ng-template>
127
+ </mona-menu-item>
128
+ </mona-menu>
129
+ </mona-menubar>
130
+ ```
131
+
132
+ When a `monaMenuItemTextTemplate` is provided without setting `label`, the projected template content is what consumers see and is also what assistive technology reads as the item's accessible name (see Accessibility below).
133
+
134
+ ## Examples
135
+
136
+ ### Submenus, groups and separators
137
+
138
+ Projecting items inside `mona-menu-item` turns it into a submenu trigger; it renders a chevron instead of a shortcut area and no longer emits `menuClick` itself.
139
+
140
+ `basic-example.component.ts`
141
+
142
+ ```typescript
143
+ import { Component, signal } from "@angular/core";
144
+ import {
145
+ MenubarComponent,
146
+ MenuComponent,
147
+ MenuGroupComponent,
148
+ MenuItemComponent,
149
+ MenuSeparatorComponent
150
+ } from "@nanahoshi/mona-ui/menubar";
151
+
152
+ @Component({
153
+ selector: "app-menubar-basic-example",
154
+ imports: [MenubarComponent, MenuComponent, MenuGroupComponent, MenuItemComponent, MenuSeparatorComponent],
155
+ templateUrl: "./basic-example.component.html"
156
+ })
157
+ export class MenubarBasicExampleComponent {
158
+ protected readonly lastAction = signal("none");
159
+ }
160
+ ```
161
+
162
+ `basic-example.component.html`
163
+
164
+ ```html
165
+ <div class="flex flex-col items-start gap-3">
166
+ <mona-menubar aria-label="Document" (menuItemClick)="lastAction.set($event.label)">
167
+ <mona-menu text="File">
168
+ <mona-menu-item label="New">
169
+ <mona-menu-item label="Document" />
170
+ <mona-menu-item label="Spreadsheet" />
171
+ </mona-menu-item>
172
+ <mona-menu-item label="Open" />
173
+ <mona-menu-separator />
174
+ <mona-menu-group title="Export">
175
+ <mona-menu-item label="Export as PDF" />
176
+ <mona-menu-item label="Export as image" />
177
+ </mona-menu-group>
178
+ <mona-menu-separator />
179
+ <mona-menu-item label="Close" />
180
+ </mona-menu>
181
+ <mona-menu text="Edit">
182
+ <mona-menu-item label="Undo" />
183
+ <mona-menu-item label="Redo" [disabled]="true" />
184
+ </mona-menu>
185
+ <mona-menu text="Help">
186
+ <mona-menu-item label="Keyboard shortcuts" />
187
+ <mona-menu-item label="About" />
188
+ </mona-menu>
189
+ </mona-menubar>
190
+ <span aria-live="polite" class="text-sm">Last action: {{ lastAction() }}</span>
191
+ </div>
192
+ ```
193
+
194
+ ### Checkbox and radio items
195
+
196
+ `checked` on a checkbox item and `value` on a radio group are two-way bindable.
197
+
198
+ `checkable-example.component.ts`
199
+
200
+ ```typescript
201
+ import { Component, signal } from "@angular/core";
202
+ import {
203
+ MenubarComponent,
204
+ MenuCheckboxItemComponent,
205
+ MenuComponent,
206
+ MenuItemComponent,
207
+ MenuRadioGroupComponent,
208
+ MenuRadioItemComponent
209
+ } from "@nanahoshi/mona-ui/menubar";
210
+
211
+ @Component({
212
+ selector: "app-menubar-checkable-example",
213
+ imports: [
214
+ MenubarComponent,
215
+ MenuCheckboxItemComponent,
216
+ MenuComponent,
217
+ MenuItemComponent,
218
+ MenuRadioGroupComponent,
219
+ MenuRadioItemComponent
220
+ ],
221
+ templateUrl: "./checkable-example.component.html"
222
+ })
223
+ export class MenubarCheckableExampleComponent {
224
+ protected readonly showGrid = signal(true);
225
+ protected readonly snapToGrid = signal(false);
226
+ protected readonly theme = signal("system");
227
+ }
228
+ ```
229
+
230
+ `checkable-example.component.html`
231
+
232
+ ```html
233
+ <div class="flex flex-col items-start gap-3">
234
+ <mona-menubar aria-label="Canvas">
235
+ <mona-menu text="View">
236
+ <mona-menu-checkbox-item label="Show grid" [(checked)]="showGrid" />
237
+ <mona-menu-checkbox-item label="Snap to grid" [(checked)]="snapToGrid" />
238
+ </mona-menu>
239
+ <mona-menu text="Appearance">
240
+ <mona-menu-item label="Theme">
241
+ <mona-menu-radio-group [(value)]="theme">
242
+ <mona-menu-radio-item label="Light" value="light" />
243
+ <mona-menu-radio-item label="Dark" value="dark" />
244
+ <mona-menu-radio-item label="System" value="system" />
245
+ </mona-menu-radio-group>
246
+ </mona-menu-item>
247
+ </mona-menu>
248
+ </mona-menubar>
249
+ <span class="text-sm">
250
+ Grid: {{ showGrid() ? "shown" : "hidden" }}. Snap: {{ snapToGrid() ? "on" : "off" }}. Theme: {{ theme() }}.
251
+ </span>
252
+ </div>
253
+ ```
254
+
255
+ ### Disabling a menu
256
+
257
+ `disabled-example.component.ts`
258
+
259
+ ```typescript
260
+ import { Component, signal } from "@angular/core";
261
+ import { CheckBoxComponent } from "@nanahoshi/mona-ui/check-box";
262
+ import { MenubarComponent, MenuComponent, MenuItemComponent } from "@nanahoshi/mona-ui/menubar";
263
+
264
+ @Component({
265
+ selector: "app-menubar-disabled-example",
266
+ imports: [CheckBoxComponent, MenubarComponent, MenuComponent, MenuItemComponent],
267
+ templateUrl: "./disabled-example.component.html"
268
+ })
269
+ export class MenubarDisabledExampleComponent {
270
+ protected readonly hasSelection = signal(false);
271
+ }
272
+ ```
273
+
274
+ `disabled-example.component.html`
275
+
276
+ ```html
277
+ <div class="flex flex-col items-start gap-3">
278
+ <mona-check-box label="Text is selected" [(checked)]="hasSelection" />
279
+ <mona-menubar aria-label="Editor">
280
+ <mona-menu text="File">
281
+ <mona-menu-item label="New" />
282
+ <mona-menu-item label="Open" />
283
+ </mona-menu>
284
+ <mona-menu text="Edit" [disabled]="!hasSelection()">
285
+ <mona-menu-item label="Cut" />
286
+ <mona-menu-item label="Copy" />
287
+ </mona-menu>
288
+ </mona-menubar>
289
+ </div>
290
+ ```
291
+
292
+ Set `[disabled]` on the whole `<mona-menubar>` to disable every menu at once, or on an individual `mona-menu` to disable only that menu. A disabled menu does not open on click, hover, or keyboard activation, but the arrow keys still reach it, so it can be read and found. A `mona-menu` without items is a plain menubar item: it doesn't advertise or open a popup.
293
+
294
+ ### Sizing and rounding
295
+
296
+ ```html
297
+ <mona-menubar size="small" rounded="large">
298
+ <mona-menu text="File">
299
+ <mona-menu-item label="New"></mona-menu-item>
300
+ </mona-menu>
301
+ </mona-menubar>
302
+ ```
303
+
304
+ `size` and `rounded` apply to the menubar itself and to every menu's popup.
305
+
306
+ ## Behavior
307
+
308
+ **`items` takes precedence over projected content.** When a `mona-menu`'s `items` input is a non-empty iterable, it is rendered instead of any projected `mona-menu-item` (and related) components.
309
+
310
+ **Keep the menu open after a click.** Calling `event.preventDefault()` in a `(menuItemClick)` handler — on `<mona-menubar>` itself or on an individual item's own `(menuClick)` — prevents the menu from closing after that selection.
311
+
312
+ **Identifying the item.** The click event's `value` is the item's `value` input, so handlers don't need to compare label text (which changes with translation). `label` is the item's label, and for checkbox and radio items `checked` is the state the item has once the click is applied.
313
+
314
+ **Suppressing checkbox/radio state changes.** Calling `event.preventDefault()` on a `mona-menu-checkbox-item`'s or `mona-menu-radio-item`'s `menuClick` event suppresses the resulting `checkedChange` emission (checkbox item) or selection update (radio group). Use this to confirm or validate a change before it applies.
315
+
316
+ **Switching menus.** While one menu's popup is open, moving the pointer over a different top-level menu closes the current popup and opens the new one; `ArrowLeft`/`ArrowRight` in the popup do the same. When the new menu is disabled or has no items, the popup just closes (from the keyboard, focus lands on that menubar item). The Tab stop follows the menu you're in. Hovering while the menubar itself is disabled has no effect.
317
+
318
+ **Items from another menu family** (a `mona-contextmenu-item` inside a `mona-menu`, say) throw an error naming the component to use.
319
+
320
+ ## Accessibility
321
+
322
+ ### Keyboard navigation
323
+
324
+ **On the menubar itself** (before a menu is open, or moving between top-level menus):
325
+
326
+ | Key | Action |
327
+ |-------------------|-----------------------------------------------------------------------------------------------|
328
+ | `Tab` | Moves focus to or from the menubar. Only one top-level menu is a Tab stop at a time. |
329
+ | `ArrowRight` | Moves focus to the next top-level menu, wrapping to the first. Disabled menus are reached too |
330
+ | `ArrowLeft` | Moves focus to the previous top-level menu, wrapping to the last |
331
+ | `Home` | Moves focus to the first top-level menu |
332
+ | `End` | Moves focus to the last top-level menu |
333
+ | `Enter` / `Space` | Opens the focused menu, with its first item highlighted |
334
+ | `ArrowDown` | Opens the focused menu with its first item highlighted, if none is currently open |
335
+ | `ArrowUp` | Opens the focused menu with its last item highlighted, if none is currently open |
336
+ | `Escape` | Closes the currently open menu |
337
+ | A letter or digit | Moves focus to the next top-level menu whose text starts with it |
338
+
339
+ **Within an open menu's popup** (same list navigation as `ContextMenuComponent`):
340
+
341
+ | Key | Action |
342
+ |----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
343
+ | `ArrowDown` | Highlights the next item, wrapping to the first. Disabled items are highlighted too, but can't be activated |
344
+ | `ArrowUp` | Highlights the previous item, wrapping to the last |
345
+ | `ArrowRight` | Opens the highlighted item's submenu if it has nested items; at the popup's root level, moves to the next top-level menu instead |
346
+ | `ArrowLeft` | Closes the current submenu and returns to the parent level; at the popup's root level, moves to the previous top-level menu instead, on the first press |
347
+ | `Home` | Highlights the first item |
348
+ | `End` | Highlights the last item |
349
+ | `Enter` / `Space` | Activates the highlighted item, or opens its submenu if it has nested items |
350
+ | `Escape` | Closes the open submenu, or the menu itself at the root level |
351
+ | `Tab` | Closes the open menus; focus moves on from the menubar |
352
+ | Letter, digit, `-`, or `_` | Jumps to (cycles through) items whose label starts with the typed text |
353
+
354
+ ### ARIA
355
+
356
+ **Menubar** (`role="menubar"`):
357
+
358
+ | Attribute | When present | Value |
359
+ |-------------------|------------------------------------|-------------------------------|
360
+ | `role` | Always | `"menubar"` |
361
+ | `aria-disabled` | Always | Reflects the `disabled` input |
362
+ | `aria-label` | When `aria-label` is non-empty | Value of `aria-label` |
363
+ | `aria-labelledby` | When `aria-labelledby` is non-empty | Value of `aria-labelledby` |
364
+
365
+ **Top-level menu** (`role="menuitem"`, one per `mona-menu`):
366
+
367
+ | Attribute | When present | Value |
368
+ |-----------------|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
369
+ | `role` | Always | `"menuitem"` |
370
+ | `tabindex` | Always | `0` for exactly one menu (roving tab stop) and `-1` for the rest; disabled menus take part. `-1` for all when the menubar is disabled |
371
+ | `aria-disabled` | Always | Reflects the menu's `disabled` input |
372
+ | `id` | Always | An auto-generated ID that names the menu's popup |
373
+ | `aria-haspopup` | When the menu has items | `"menu"` |
374
+ | `aria-expanded` | When the menu has items | `"true"` while that menu's popup is open, otherwise `"false"` |
375
+ | `aria-controls` | While that menu's popup is open | The popup menu container's auto-generated ID |
376
+
377
+ **Popup menu container** (`role="menu"`), **item** (`role="menuitem"`), and **group** (`role="group"`): the popup is labelled by its top-level menu (`aria-labelledby`); otherwise the same attributes as `ContextMenuComponent`'s popup — see its documentation for the full table. In summary: the container carries `aria-orientation="vertical"` and `aria-activedescendant` while an item is highlighted; checkbox and radio items are `menuitemcheckbox` and `menuitemradio` with `aria-checked`; each item carries `aria-disabled`, `aria-haspopup`/`aria-expanded` when it has nested items, and `aria-label` when its `label` is non-empty; groups wrap their header and items and carry `aria-labelledby`.
378
+
379
+ **Focus behavior:** on the menubar itself, exactly one top-level menu is a Tab stop at a time (roving tabindex) and Arrow keys move it. Once a popup opens, focus moves into its `role="menu"` container the same way as `ContextMenuComponent`; the highlighted item is communicated through `aria-activedescendant` rather than DOM focus. When a popup closes (Escape, choosing an item, or a click outside that doesn't move focus elsewhere), focus returns to its top-level menu. `Tab` closes the popup and moves focus out of the menubar. A submenu opened by the pointer leaves focus in its parent menu.
380
+
381
+ **Consumer responsibilities:**
382
+
383
+ - Provide `aria-label` or `aria-labelledby` on `<mona-menubar>` when the surrounding page does not already identify the menubar's purpose.
384
+ - When an item uses a `monaMenuItemTextTemplate` and the item's `label` is left empty, no `aria-label` fallback is applied; ensure the projected template content alone communicates the item.
385
+
386
+ ## API
387
+
388
+ Everything below is imported from `@nanahoshi/mona-ui/menubar`.
389
+
390
+ ### `MenubarComponent`
391
+
392
+ **Selector:** `mona-menubar`
393
+
394
+ #### Inputs
395
+
396
+ | Name | Type | Default | Description |
397
+ | --- | --- | --- | --- |
398
+ | `aria-label` | `string` | `""` | ARIA label for the menubar. |
399
+ | `aria-labelledby` | `string` | `""` | ARIA labelledby for the menubar. |
400
+ | `class` | `string` | `""` | Additional CSS classes to apply to the menubar, merged with the computed theme classes. |
401
+ | `disabled` | `boolean` | `false` | Sets the disabled state of menubar. |
402
+ | `rounded` | `"large" \| "medium" \| "none" \| "small"` | `"medium"` | Sets the rounded style of the menubar. |
403
+ | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Sets the size of the menubar. |
404
+
405
+ #### Outputs
406
+
407
+ | Name | Type | Description |
408
+ | --- | --- | --- |
409
+ | `menuItemClick` | `PopupMenuItemClickEvent` | Emits when a menu item is clicked. |
410
+
411
+ ### `MenuCheckboxItemComponent`
412
+
413
+ **Selector:** `mona-menu-checkbox-item`
414
+ **Extends:** `PopupMenuCheckboxItemComponent`
415
+
416
+ #### Inputs
417
+
418
+ | Name | Type | Default | Description |
419
+ | --- | --- | --- | --- |
420
+ | `checked` (two-way) | `boolean` | `false` | The checked state of the menu item. Activating the item toggles it (unless its `menuClick` is prevented) and emits `checkedChange`, so it works with or without a two-way binding. |
421
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
422
+ | `label` | `string` | `""` | The text of the menu item. |
423
+ | `value` | `unknown` | — | A value that identifies the item. It's the `value` of the item's `menuClick` events. |
424
+
425
+ #### Outputs
426
+
427
+ | Name | Type | Description |
428
+ | --- | --- | --- |
429
+ | `checkedChange` | `boolean` | Emitted when `checked` changes. |
430
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse. |
431
+
432
+ ### `MenuItemComponent`
433
+
434
+ **Selector:** `mona-menu-item`
435
+ **Extends:** `PopupMenuItemComponent`
436
+
437
+ #### Inputs
438
+
439
+ | Name | Type | Default | Description |
440
+ | --- | --- | --- | --- |
441
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
442
+ | `label` | `string` | `""` | The text of the menu item. |
443
+ | `value` | `unknown` | — | A value that identifies the item. It's the `value` of the item's `menuClick` events, so handlers don't depend on the label's text. |
444
+
445
+ #### Outputs
446
+
447
+ | Name | Type | Description |
448
+ | --- | --- | --- |
449
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse. |
450
+
451
+ ### `MenuRadioItemComponent`
452
+
453
+ **Selector:** `mona-menu-radio-item`
454
+ **Extends:** `PopupMenuRadioItemComponent`
455
+
456
+ #### Inputs
457
+
458
+ | Name | Type | Default | Description |
459
+ | --- | --- | --- | --- |
460
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
461
+ | `label` | `string` | `""` | The text of the menu item. |
462
+ | `value` (required) | `string` | — | The value of the radio item. |
463
+
464
+ #### Outputs
465
+
466
+ | Name | Type | Description |
467
+ | --- | --- | --- |
468
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse, before the radio group selects it. Preventing it keeps the group's value and the menu open. |
469
+
470
+ ### `MenuComponent`
471
+
472
+ A top-level menu. Its `text` is displayed on the menubar; its projected items (or `items` input) become the popup
473
+ content.
474
+
475
+ **Selector:** `mona-menu`
476
+
477
+ #### Inputs
478
+
479
+ | Name | Type | Default | Description |
480
+ | --- | --- | --- | --- |
481
+ | `disabled` | `boolean` | `false` | Sets the menu as disabled. |
482
+ | `items` | `Iterable<MenuItem>` | `[]` | Sets the items of the menu. If provided, it will override the menu items defined by the menu item components. |
483
+ | `text` | `string` | `""` | The text of the menu. |
484
+
485
+ ### `MenuRadioGroupComponent`
486
+
487
+ **Selector:** `mona-menu-radio-group`
488
+ **Extends:** `PopupMenuRadioGroupComponent`
489
+
490
+ #### Inputs
491
+
492
+ | Name | Type | Default | Description |
493
+ | --- | --- | --- | --- |
494
+ | `title` | `string` | `""` | The title of the radio group. |
495
+ | `value` (two-way) | `string` | `""` | The value of the selected radio item. |
496
+
497
+ #### Outputs
498
+
499
+ | Name | Type | Description |
500
+ | --- | --- | --- |
501
+ | `valueChange` | `string` | Emitted when `value` changes. |
502
+
503
+ ### `MenuGroupComponent`
504
+
505
+ **Selector:** `mona-menu-group`
506
+ **Extends:** `PopupMenuGroupComponent`
507
+
508
+ #### Inputs
509
+
510
+ | Name | Type | Default | Description |
511
+ | --- | --- | --- | --- |
512
+ | `title` | `string` | — | Sets the title of the menu group. |
513
+
514
+ ### `MenuSeparatorComponent`
515
+
516
+ Renders a horizontal visual divider between items.
517
+
518
+ **Selector:** `mona-menu-separator`
519
+ **Extends:** `PopupMenuSeparatorComponent`
520
+
521
+ ### `MenuGroupTemplateDirective`
522
+
523
+ Customizes a group header's content.
524
+
525
+ **Selector:** `ng-template[monaMenuGroupTemplate]`
526
+ **Extends:** `PopupMenuGroupTemplateDirective`
527
+
528
+ ### `MenuIconTemplateDirective`
529
+
530
+ **Selector:** `ng-template[monaMenuIconTemplate]`
531
+
532
+ ### `MenuItemIconTemplateDirective`
533
+
534
+ **Selector:** `ng-template[monaMenuItemIconTemplate]`
535
+ **Extends:** `PopupMenuIconTemplateDirective`
536
+
537
+ ### `MenuItemShortcutTemplateDirective`
538
+
539
+ **Selector:** `ng-template[monaMenuItemShortcutTemplate]`
540
+ **Extends:** `PopupMenuShortcutTemplateDirective`
541
+
542
+ ### `MenuItemTextTemplateDirective`
543
+
544
+ **Selector:** `ng-template[monaMenuItemTextTemplate]`
545
+ **Extends:** `PopupMenuTextTemplateDirective`
546
+
547
+ ### `MenuTextTemplateDirective`
548
+
549
+ **Selector:** `ng-template[monaMenuTextTemplate]`
550
+
551
+ ### Types
552
+
553
+ #### `MenuItemClickEvent`
554
+
555
+ ```typescript
556
+ type MenuItemClickEvent = PopupMenuItemClickEvent;
557
+ ```
558
+
559
+ **Documented elsewhere:** [`MenuItem`](popup-menu.md), [`PopupMenuCheckboxItemComponent`](popup-menu.md), [`PopupMenuGroupComponent`](popup-menu.md), [`PopupMenuGroupTemplateDirective`](popup-menu.md), [`PopupMenuIconTemplateDirective`](popup-menu.md), [`PopupMenuItemClickEvent`](popup-menu.md), [`PopupMenuItemComponent`](popup-menu.md), [`PopupMenuRadioGroupComponent`](popup-menu.md), [`PopupMenuRadioItemComponent`](popup-menu.md), [`PopupMenuSeparatorComponent`](popup-menu.md), [`PopupMenuShortcutTemplateDirective`](popup-menu.md), [`PopupMenuTextTemplateDirective`](popup-menu.md)