@nanahoshi/mona-ui 0.25.0 → 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 (227) 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-group.mjs +1 -1
  75. package/fesm2022/nanahoshi-mona-ui-button.mjs +14 -2
  76. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  77. package/fesm2022/nanahoshi-mona-ui-chart.mjs +108 -22
  78. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-chip.mjs +1 -1
  80. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  81. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  82. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  83. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  84. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  85. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  86. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  87. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  88. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  89. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  90. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  91. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  92. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  93. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  97. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  98. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  99. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  100. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  102. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  103. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  104. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  105. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  118. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  119. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  120. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  121. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  122. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  123. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  124. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  125. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  126. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  127. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  128. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  129. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  130. package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +7 -3
  131. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +2 -1
  132. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  133. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  134. package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -3
  135. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +10 -7
  136. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  137. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  138. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  139. package/fesm2022/nanahoshi-mona-ui-theme.mjs +53 -21
  140. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  141. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  142. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  143. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  144. package/i18n/catalogs/en-US.messages.json +10 -0
  145. package/internal/popup-menu/package.json +4 -0
  146. package/llms.txt +123 -0
  147. package/locales/ar-sa/ar-sa.messages.json +10 -0
  148. package/locales/de-de/de-de.messages.json +10 -0
  149. package/locales/es-es/es-es.messages.json +10 -0
  150. package/locales/fr-fr/fr-fr.messages.json +10 -0
  151. package/locales/id-id/id-id.messages.json +10 -0
  152. package/locales/it-it/it-it.messages.json +10 -0
  153. package/locales/ja-jp/ja-jp.messages.json +10 -0
  154. package/locales/ko-kr/ko-kr.messages.json +10 -0
  155. package/locales/pt-br/pt-br.messages.json +10 -0
  156. package/locales/ru-ru/ru-ru.messages.json +10 -0
  157. package/locales/tr-tr/tr-tr.messages.json +10 -0
  158. package/locales/zh-cn/zh-cn.messages.json +10 -0
  159. package/locales/zh-tw/zh-tw.messages.json +10 -0
  160. package/package.json +9 -1
  161. package/styles.css +12 -2
  162. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  163. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  164. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  165. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  166. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  167. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  168. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  169. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  170. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  171. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  172. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  173. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  174. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  175. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  176. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  177. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  178. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  179. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  180. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  181. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  182. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  183. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  184. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  185. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  186. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  187. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  188. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  189. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  190. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  191. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  192. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  201. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  202. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  203. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  204. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  205. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  206. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  207. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  208. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  209. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  210. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  211. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  212. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  213. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  214. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  215. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  216. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  217. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  218. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  219. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  220. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  221. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  222. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  223. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  224. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  225. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  226. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  227. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,507 @@
1
+ # Dropdown Button
2
+
3
+ > A single button that opens a menu of actions.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/dropdown-button`
6
+
7
+ **Selectors:** `mona-dropdown-button` · `mona-dropdown-button-item` · `mona-dropdown-button-group` · `mona-dropdown-button-separator` · `mona-dropdown-button-checkbox-item` · `mona-dropdown-button-radio-group` · `mona-dropdown-button-radio-item`
8
+
9
+ `DropdownButtonComponent` renders a single button that opens a popup menu of actions when clicked.
10
+
11
+ ## Overview
12
+
13
+ `DropdownButtonComponent` is a single button control that reveals a popup menu of secondary actions or options when clicked. The button itself serves as both the visible label and the popup trigger — there is no separate toggle like in `SplitButtonComponent`.
14
+
15
+ **Use `DropdownButtonComponent` when you need to:**
16
+
17
+ - Present a set of related actions where no single action is dominant (e.g., a "More actions" button, an "Options" menu, a multi-step form action picker)
18
+ - Combine a compact icon-only trigger with a full dropdown list of labeled options
19
+ - Provide a dropdown in a toolbar where space is constrained
20
+
21
+ **Use `SplitButtonComponent` instead when:**
22
+
23
+ - One action is clearly the primary choice and should remain one click away
24
+ - You need to distinguish between "execute default action" and "choose a different action" at the event level — `SplitButtonComponent` emits `buttonClick` for the primary action and `menuItemClick` for menu selections separately
25
+
26
+ ## Import & Quick Start
27
+
28
+ ```typescript
29
+ import { DropdownButtonCheckboxItemComponent, DropdownButtonComponent, DropdownButtonGroupComponent, DropdownButtonItemComponent, DropdownButtonRadioGroupComponent, DropdownButtonRadioItemComponent, DropdownButtonSeparatorComponent } from "@nanahoshi/mona-ui/dropdown-button";
30
+ ```
31
+
32
+ Add the components you need to your standalone component's `imports` array.
33
+
34
+ **Minimal example:**
35
+
36
+ ```html
37
+ <mona-dropdown-button text="Options" (menuItemClick)="onAction($event)">
38
+ <mona-dropdown-button-item label="Edit"></mona-dropdown-button-item>
39
+ <mona-dropdown-button-item label="Duplicate"></mona-dropdown-button-item>
40
+ <mona-dropdown-button-separator></mona-dropdown-button-separator>
41
+ <mona-dropdown-button-item label="Delete"></mona-dropdown-button-item>
42
+ </mona-dropdown-button>
43
+ ```
44
+
45
+ ```typescript
46
+ import type { PopupMenuItemClickEvent } from "@nanahoshi/mona-ui/popup-menu";
47
+
48
+ protected onAction(event: PopupMenuItemClickEvent): void { /* ... */ }
49
+ ```
50
+
51
+ ## Anatomy
52
+
53
+ ### Content projection
54
+
55
+ Menu items are projected directly inside `<mona-dropdown-button>`. Only the dropdown-button family of components and their associated `ng-template` directives are valid children.
56
+
57
+ ```
58
+ mona-dropdown-button
59
+ ├── mona-dropdown-button-item — a clickable menu item
60
+ ├── mona-dropdown-button-group — a titled section of items
61
+ │ └── mona-dropdown-button-item
62
+ ├── mona-dropdown-button-separator — a horizontal divider
63
+ ├── mona-dropdown-button-checkbox-item — a toggle menu item
64
+ └── mona-dropdown-button-radio-group — mutually exclusive choices
65
+ └── mona-dropdown-button-radio-item
66
+ ```
67
+
68
+ ### Template directives
69
+
70
+ Templates placed directly inside `<mona-dropdown-button>` apply globally to all matching items. Templates nested inside a specific item override only that item.
71
+
72
+ | Directive attribute | Scope | Template context |
73
+ |----------------------------------------------|----------------|------------------------------------------------------|
74
+ | `monaDropdownButtonTextTemplate` | Button label | `$implicit: string` — the current `text` input value |
75
+ | `monaDropdownButtonMenuGroupTemplate` | Global / Group | `$implicit: string` — the group title |
76
+ | `monaDropdownButtonMenuItemIconTemplate` | Global / Item | `$implicit` — menu item object (`label`, `disabled`) |
77
+ | `monaDropdownButtonMenuItemShortcutTemplate` | Global / Item | `$implicit` — menu item object (`label`, `disabled`) |
78
+ | `monaDropdownButtonMenuItemTextTemplate` | Global / Item | `$implicit` — menu item object (`label`, `disabled`) |
79
+
80
+ **Customize the button label** (`monaDropdownButtonTextTemplate` receives the `text` value as context):
81
+
82
+ ```html
83
+ <mona-dropdown-button text="Actions">
84
+ <ng-template monaDropdownButtonTextTemplate let-text>
85
+ <span class="font-semibold text-primary">{{ text }}</span>
86
+ </ng-template>
87
+ </mona-dropdown-button>
88
+ ```
89
+
90
+ **Custom text per menu item:**
91
+
92
+ ```html
93
+ <mona-dropdown-button text="Actions">
94
+ <mona-dropdown-button-item label="Delete">
95
+ <ng-template monaDropdownButtonMenuItemTextTemplate let-item>
96
+ <span class="text-destructive">{{ item.label }}</span>
97
+ </ng-template>
98
+ </mona-dropdown-button-item>
99
+ </mona-dropdown-button>
100
+ ```
101
+
102
+ ## Examples
103
+
104
+ ### Groups, separators and disabled items
105
+
106
+ A disabled item stays in the menu and the arrow keys reach it, but it can't be chosen. `[disabled]` on the dropdown button itself disables the whole control.
107
+
108
+ `groups-example.component.ts`
109
+
110
+ ```typescript
111
+ import { Component, signal } from "@angular/core";
112
+ import {
113
+ DropdownButtonComponent,
114
+ DropdownButtonGroupComponent,
115
+ DropdownButtonItemComponent,
116
+ DropdownButtonSeparatorComponent
117
+ } from "@nanahoshi/mona-ui/dropdown-button";
118
+
119
+ @Component({
120
+ selector: "app-dropdown-button-groups-example",
121
+ imports: [
122
+ DropdownButtonComponent,
123
+ DropdownButtonGroupComponent,
124
+ DropdownButtonItemComponent,
125
+ DropdownButtonSeparatorComponent
126
+ ],
127
+ templateUrl: "./groups-example.component.html"
128
+ })
129
+ export class DropdownButtonGroupsExampleComponent {
130
+ protected readonly lastAction = signal("none");
131
+ }
132
+ ```
133
+
134
+ `groups-example.component.html`
135
+
136
+ ```html
137
+ <div class="flex flex-wrap items-center gap-3">
138
+ <mona-dropdown-button text="File" (menuItemClick)="lastAction.set($event.label)">
139
+ <mona-dropdown-button-group title="Document">
140
+ <mona-dropdown-button-item label="New" />
141
+ <mona-dropdown-button-item label="Open" />
142
+ <mona-dropdown-button-item label="Save" [disabled]="true" />
143
+ </mona-dropdown-button-group>
144
+ <mona-dropdown-button-separator />
145
+ <mona-dropdown-button-item label="Print" />
146
+ </mona-dropdown-button>
147
+ <span aria-live="polite" class="text-sm">Last action: {{ lastAction() }}</span>
148
+ </div>
149
+ ```
150
+
151
+ ### Checkbox and radio items
152
+
153
+ `checked` on a checkbox item and `value` on a radio group are two-way bindable.
154
+
155
+ `checkable-example.component.ts`
156
+
157
+ ```typescript
158
+ import { Component, signal } from "@angular/core";
159
+ import {
160
+ DropdownButtonCheckboxItemComponent,
161
+ DropdownButtonComponent,
162
+ DropdownButtonRadioGroupComponent,
163
+ DropdownButtonRadioItemComponent,
164
+ DropdownButtonSeparatorComponent
165
+ } from "@nanahoshi/mona-ui/dropdown-button";
166
+
167
+ @Component({
168
+ selector: "app-dropdown-button-checkable-example",
169
+ imports: [
170
+ DropdownButtonCheckboxItemComponent,
171
+ DropdownButtonComponent,
172
+ DropdownButtonRadioGroupComponent,
173
+ DropdownButtonRadioItemComponent,
174
+ DropdownButtonSeparatorComponent
175
+ ],
176
+ templateUrl: "./checkable-example.component.html"
177
+ })
178
+ export class DropdownButtonCheckableExampleComponent {
179
+ protected readonly notifications = signal(true);
180
+ protected readonly priority = signal("medium");
181
+ }
182
+ ```
183
+
184
+ `checkable-example.component.html`
185
+
186
+ ```html
187
+ <div class="flex flex-wrap items-center gap-3">
188
+ <mona-dropdown-button text="Task settings">
189
+ <mona-dropdown-button-checkbox-item label="Notify me" [(checked)]="notifications" />
190
+ <mona-dropdown-button-separator />
191
+ <mona-dropdown-button-radio-group title="Priority" [(value)]="priority">
192
+ <mona-dropdown-button-radio-item label="Low" value="low" />
193
+ <mona-dropdown-button-radio-item label="Medium" value="medium" />
194
+ <mona-dropdown-button-radio-item label="High" value="high" />
195
+ </mona-dropdown-button-radio-group>
196
+ </mona-dropdown-button>
197
+ <span class="text-sm">Notifications: {{ notifications() ? "on" : "off" }}. Priority: {{ priority() }}.</span>
198
+ </div>
199
+ ```
200
+
201
+ ### Icon-only trigger
202
+
203
+ An icon-only button has no text to read out, so it needs an `aria-label`. The arrow is hidden while `iconOnly` is on.
204
+
205
+ `icon-only-example.component.ts`
206
+
207
+ ```typescript
208
+ import { Component } from "@angular/core";
209
+ import { LucideEllipsis } from "@lucide/angular";
210
+ import {
211
+ DropdownButtonComponent,
212
+ DropdownButtonItemComponent,
213
+ DropdownButtonTextTemplateDirective
214
+ } from "@nanahoshi/mona-ui/dropdown-button";
215
+
216
+ @Component({
217
+ selector: "app-dropdown-button-icon-only-example",
218
+ imports: [DropdownButtonComponent, DropdownButtonItemComponent, DropdownButtonTextTemplateDirective, LucideEllipsis],
219
+ templateUrl: "./icon-only-example.component.html"
220
+ })
221
+ export class DropdownButtonIconOnlyExampleComponent {}
222
+ ```
223
+
224
+ `icon-only-example.component.html`
225
+
226
+ ```html
227
+ <mona-dropdown-button aria-label="Row actions" look="ghost" [iconOnly]="true">
228
+ <ng-template monaDropdownButtonTextTemplate>
229
+ <svg lucideEllipsis aria-hidden="true" [size]="16"></svg>
230
+ </ng-template>
231
+ <mona-dropdown-button-item label="Edit" />
232
+ <mona-dropdown-button-item label="Duplicate" />
233
+ <mona-dropdown-button-item label="Delete" />
234
+ </mona-dropdown-button>
235
+ ```
236
+
237
+ ### Loading state
238
+
239
+ When `loading` is `true`, the button displays a spinner and ignores click interactions. Use this while an async operation triggered by a previous menu selection is in progress.
240
+
241
+ `loading-example.component.ts`
242
+
243
+ ```typescript
244
+ import { Component, signal } from "@angular/core";
245
+ import { DropdownButtonComponent, DropdownButtonItemComponent } from "@nanahoshi/mona-ui/dropdown-button";
246
+ import type { PopupMenuItemClickEvent } from "@nanahoshi/mona-ui/popup-menu";
247
+
248
+ @Component({
249
+ selector: "app-dropdown-button-loading-example",
250
+ imports: [DropdownButtonComponent, DropdownButtonItemComponent],
251
+ templateUrl: "./loading-example.component.html"
252
+ })
253
+ export class DropdownButtonLoadingExampleComponent {
254
+ protected readonly exporting = signal(false);
255
+ protected readonly status = signal("Nothing exported yet");
256
+
257
+ protected export(event: PopupMenuItemClickEvent): void {
258
+ this.exporting.set(true);
259
+ this.status.set(`Exporting as ${event.label}…`);
260
+ // Stands in for a request to the server.
261
+ setTimeout(() => {
262
+ this.exporting.set(false);
263
+ this.status.set(`Exported as ${event.label}`);
264
+ }, 1500);
265
+ }
266
+ }
267
+ ```
268
+
269
+ `loading-example.component.html`
270
+
271
+ ```html
272
+ <div class="flex flex-wrap items-center gap-3">
273
+ <mona-dropdown-button text="Export" [loading]="exporting()" (menuItemClick)="export($event)">
274
+ <mona-dropdown-button-item label="CSV" />
275
+ <mona-dropdown-button-item label="PDF" />
276
+ </mona-dropdown-button>
277
+ <span aria-live="polite" class="text-sm">{{ status() }}</span>
278
+ </div>
279
+ ```
280
+
281
+ ## Behavior
282
+
283
+ ### Popup positioning
284
+
285
+ The popup anchors to the center of the button (`bottomcenter` / `topcenter`) with a 2px vertical offset. The popup repositions above the button if there is insufficient space below. The menu is at least as wide as the button (set `popupWidth` for a fixed minimum), and its corners follow `rounded`.
286
+
287
+ ### In a button group
288
+
289
+ Inside `mona-button-group`, the dropdown button takes the group's look, size, rounding and disabled state. It isn't a toggle and takes no part in the group's selection.
290
+
291
+ ### Disabled and loading
292
+
293
+ Setting `disabled` or `loading` while the menu is open closes it, and the keyboard can't open it again until both are `false`.
294
+
295
+ ### Naming and the arrow
296
+
297
+ The button is named by its content: the `text`, or what a `monaDropdownButtonTextTemplate` renders. Set `aria-label` (or `aria-labelledby`) only when the content isn't a name, as with `iconOnly`. The button already says it opens a menu (`aria-haspopup`), so the name shouldn't repeat that. A down arrow follows the text unless `showArrow` is `false` or the button is `iconOnly`.
298
+
299
+ ### Handling menu item events
300
+
301
+ `menuItemClick` on `DropdownButtonComponent` fires for any item in the popup. `menuClick` on individual `mona-dropdown-button-item`, `mona-dropdown-button-checkbox-item`, or `mona-dropdown-button-radio-item` fires only for that specific item. Use item-level `menuClick` for per-action handlers.
302
+
303
+ ### Identifying the clicked item
304
+
305
+ 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.
306
+
307
+ ### Preventing default behavior in checkbox items
308
+
309
+ Calling `event.preventDefault()` on the `menuClick` event of a `mona-dropdown-button-checkbox-item` suppresses both the state flip and the `checkedChange` emission. On a `mona-dropdown-button-radio-item`, it keeps the radio group's value. Use this when you need to validate or confirm the change before applying it.
310
+
311
+ ## Accessibility
312
+
313
+ ### Keyboard navigation
314
+
315
+ | Key | Action |
316
+ |---------------------------------|------------------------------------------------|
317
+ | `Tab` | Move focus to / from the button |
318
+ | `ArrowDown` / `Enter` / `Space` | Open the menu with its first item highlighted |
319
+ | `ArrowUp` | Open the menu with its last item highlighted |
320
+ | `Escape` (while menu open) | Close the popup and return focus to the button |
321
+
322
+ Inside the menu:
323
+
324
+ | Key | Action |
325
+ |-------------------|-------------------------------------------------------------------------------------------------------------|
326
+ | `ArrowDown` | Highlights the next item, wrapping to the first. Disabled items are highlighted too, but can't be activated |
327
+ | `ArrowUp` | Highlights the previous item, wrapping to the last |
328
+ | `ArrowRight` | Opens the highlighted item's submenu, if it has nested items |
329
+ | `ArrowLeft` | Closes the current submenu and returns to the parent level |
330
+ | `Home` | Highlights the first item |
331
+ | `End` | Highlights the last item |
332
+ | `Enter` / `Space` | Activates the highlighted item, or opens its submenu if it has nested items |
333
+ | `Escape` | Closes the open submenu, or the menu, returning focus to the button |
334
+ | `Tab` | Closes the menu and its submenus; focus moves on from the button |
335
+
336
+ ### ARIA
337
+
338
+ The button element carries the following attributes:
339
+
340
+ | Attribute | When present | Value |
341
+ |-------------------|------------------------------------------------------|-----------------------------------------------------------------|
342
+ | `aria-haspopup` | Always | `"menu"` |
343
+ | `aria-expanded` | Always | `"true"` when the menu is open, `"false"` when closed |
344
+ | `aria-controls` | While the menu is open | The menu's ID |
345
+ | `aria-label` | When `aria-label` is set and `aria-labelledby` isn't | The `aria-label` input |
346
+ | `aria-labelledby` | When `aria-labelledby` is set | The `aria-labelledby` input; takes precedence over `aria-label` |
347
+
348
+ The menu is named by the button, through `aria-labelledby`.
349
+
350
+ **Consumer responsibilities:**
351
+
352
+ - When using `iconOnly` mode with no visible `text`, always provide `aria-label` with a description of the button's purpose.
353
+ - When `aria-labelledby` is set, `aria-label` is suppressed automatically.
354
+
355
+ ## API
356
+
357
+ Everything below is imported from `@nanahoshi/mona-ui/dropdown-button`.
358
+
359
+ ### `DropdownButtonComponent`
360
+
361
+ **Selector:** `mona-dropdown-button`
362
+
363
+ #### Inputs
364
+
365
+ | Name | Type | Default | Description |
366
+ | --- | --- | --- | --- |
367
+ | `aria-label` | `string` | `""` | Accessible name for the dropdown button. Leave it empty when the button shows its name as text; set it (or `aria-labelledby`) when the button shows only an icon. |
368
+ | `aria-labelledby` | `string` | `""` | ID of an external element that provides the accessible name for the dropdown button. Takes precedence over `aria-label` when both are set. |
369
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
370
+ | `disabled` | `boolean` | `false` | Renders the button with reduced visual emphasis and removes pointer interaction. Disabling the button closes its open menu. |
371
+ | `iconOnly` | `boolean` | `false` | Renders the button as a square for icon-only usage, removing horizontal text padding and the arrow. Set `aria-label` when no visible text is present to ensure an accessible name. |
372
+ | `loading` | `boolean` | `false` | Displays a loading indicator and prevents interaction while an operation is in progress. Starting to load closes the open menu. |
373
+ | `look` | `"clear" \| "default" \| "error" \| "ghost" \| "info" \| "link" \| "outline" \| "primary" \| "secondary" \| "success" \| "warning"` | `"default"` | Visual style preset applied to the button. |
374
+ | `popupWidth` | `number` | `0` | Minimum width of the popup menu in pixels. A value of `0` makes the menu at least as wide as the button. |
375
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the button. The menu follows it (`"full"` gives it large corners). |
376
+ | `showArrow` | `boolean` | `true` | Shows a down arrow after the text, so the button reads as one that opens a menu. Icon-only buttons never show it. |
377
+ | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the button's dimensions. |
378
+ | `text` | `string` | `""` | Primary text content displayed inside the dropdown button. Passed as `$implicit` to a `monaDropdownButtonTextTemplate` when one is provided. |
379
+
380
+ #### Outputs
381
+
382
+ | Name | Type | Description |
383
+ | --- | --- | --- |
384
+ | `menuItemClick` | `PopupMenuItemClickEvent` | Emitted when a menu item in the dropdown menu is clicked. |
385
+
386
+ ### `DropdownButtonCheckboxItemComponent`
387
+
388
+ **Selector:** `mona-dropdown-button-checkbox-item`
389
+ **Extends:** `PopupMenuCheckboxItemComponent`
390
+
391
+ #### Inputs
392
+
393
+ | Name | Type | Default | Description |
394
+ | --- | --- | --- | --- |
395
+ | `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. |
396
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
397
+ | `label` | `string` | `""` | The text of the menu item. |
398
+ | `value` | `unknown` | — | A value that identifies the item. It's the `value` of the item's `menuClick` events. |
399
+
400
+ #### Outputs
401
+
402
+ | Name | Type | Description |
403
+ | --- | --- | --- |
404
+ | `checkedChange` | `boolean` | Emitted when `checked` changes. |
405
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse. |
406
+
407
+ ### `DropdownButtonItemComponent`
408
+
409
+ **Selector:** `mona-dropdown-button-item`
410
+ **Extends:** `PopupMenuItemComponent`
411
+
412
+ #### Inputs
413
+
414
+ | Name | Type | Default | Description |
415
+ | --- | --- | --- | --- |
416
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
417
+ | `label` | `string` | `""` | The text of the menu item. |
418
+ | `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. |
419
+
420
+ #### Outputs
421
+
422
+ | Name | Type | Description |
423
+ | --- | --- | --- |
424
+ | `menuClick` | `PopupMenuItemClickEvent` | The click event of the menu item. Emits when the menu item is selected by keyboard or mouse. |
425
+
426
+ ### `DropdownButtonRadioItemComponent`
427
+
428
+ **Selector:** `mona-dropdown-button-radio-item`
429
+ **Extends:** `PopupMenuRadioItemComponent`
430
+
431
+ #### Inputs
432
+
433
+ | Name | Type | Default | Description |
434
+ | --- | --- | --- | --- |
435
+ | `disabled` | `boolean` | `false` | Sets the disabled state of the menu item. |
436
+ | `label` | `string` | `""` | The text of the menu item. |
437
+ | `value` (required) | `string` | — | The value of the radio item. |
438
+
439
+ #### Outputs
440
+
441
+ | Name | Type | Description |
442
+ | --- | --- | --- |
443
+ | `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. |
444
+
445
+ ### `DropdownButtonRadioGroupComponent`
446
+
447
+ **Selector:** `mona-dropdown-button-radio-group`
448
+ **Extends:** `PopupMenuRadioGroupComponent`
449
+
450
+ #### Inputs
451
+
452
+ | Name | Type | Default | Description |
453
+ | --- | --- | --- | --- |
454
+ | `title` | `string` | `""` | The title of the radio group. |
455
+ | `value` (two-way) | `string` | `""` | The value of the selected radio item. |
456
+
457
+ #### Outputs
458
+
459
+ | Name | Type | Description |
460
+ | --- | --- | --- |
461
+ | `valueChange` | `string` | Emitted when `value` changes. |
462
+
463
+ ### `DropdownButtonGroupComponent`
464
+
465
+ **Selector:** `mona-dropdown-button-group`
466
+ **Extends:** `PopupMenuGroupComponent`
467
+
468
+ #### Inputs
469
+
470
+ | Name | Type | Default | Description |
471
+ | --- | --- | --- | --- |
472
+ | `title` | `string` | — | Sets the title of the menu group. |
473
+
474
+ ### `DropdownButtonSeparatorComponent`
475
+
476
+ Renders a horizontal visual divider between sections.
477
+
478
+ **Selector:** `mona-dropdown-button-separator`
479
+ **Extends:** `PopupMenuSeparatorComponent`
480
+
481
+ ### `DropdownButtonMenuGroupTemplateDirective`
482
+
483
+ **Selector:** `ng-template[monaDropdownButtonMenuGroupTemplate]`
484
+ **Extends:** `PopupMenuGroupTemplateDirective`
485
+
486
+ ### `DropdownButtonMenuItemIconTemplateDirective`
487
+
488
+ **Selector:** `ng-template[monaDropdownButtonMenuItemIconTemplate]`
489
+ **Extends:** `PopupMenuIconTemplateDirective`
490
+
491
+ ### `DropdownButtonMenuItemShortcutTemplateDirective`
492
+
493
+ **Selector:** `ng-template[monaDropdownButtonMenuItemShortcutTemplate]`
494
+ **Extends:** `PopupMenuShortcutTemplateDirective`
495
+
496
+ ### `DropdownButtonMenuItemTextTemplateDirective`
497
+
498
+ **Selector:** `ng-template[monaDropdownButtonMenuItemTextTemplate]`
499
+ **Extends:** `PopupMenuTextTemplateDirective`
500
+
501
+ ### `DropdownButtonTextTemplateDirective`
502
+
503
+ **Selector:** `ng-template[monaDropdownButtonTextTemplate]`
504
+
505
+ ### Types
506
+
507
+ **Documented elsewhere:** [`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)