@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,176 @@
1
+ # Placeholder
2
+
3
+ > Fills an empty area with a muted label or projected content.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/placeholder`
6
+
7
+ **Selector:** `mona-placeholder`
8
+
9
+ `PlaceholderComponent` renders a centered, muted label or projected content to fill an empty area while real content is absent. For a region that's loading, use `mona-skeleton`.
10
+
11
+ ## Overview
12
+
13
+ `PlaceholderComponent` fills its parent container and centers its content. It has two display modes:
14
+
15
+ - **Text mode** — set the `text` input to render a muted, uppercase label inside a `<span>`.
16
+ - **Projected content mode** — project any content when `text` is empty.
17
+
18
+ When both are provided, `text` takes precedence and projected content is not rendered.
19
+
20
+ **Use `PlaceholderComponent` when you need to:**
21
+
22
+ - Signal an empty state inside a panel, card, or data region (e.g., "No results")
23
+ - Wrap a custom empty-state illustration or icon inside a consistently sized, centered slot
24
+
25
+ **Use `mona-skeleton` instead when:**
26
+
27
+ - A region is still loading
28
+
29
+ ## Import & Quick Start
30
+
31
+ ```typescript
32
+ import { PlaceholderComponent } from "@nanahoshi/mona-ui/placeholder";
33
+ ```
34
+
35
+ Add `PlaceholderComponent` to your standalone component's `imports` array.
36
+
37
+ ```html
38
+ <div class="h-40 border border-border rounded-md">
39
+ <mona-placeholder text="No items"></mona-placeholder>
40
+ </div>
41
+ ```
42
+
43
+ > **Sizing:** `PlaceholderComponent` fills its parent with `w-full h-full`. The parent element must have an explicit height for the placeholder to be visible. Setting height via a `class` on the parent or via the component's `class` input both work.
44
+
45
+ ## Examples
46
+
47
+ ### Text and projected content
48
+
49
+ Set `text` for a muted, uppercase label, or leave it empty and project any content.
50
+
51
+ `empty-state-example.component.ts`
52
+
53
+ ```typescript
54
+ import { Component } from "@angular/core";
55
+ import { LucideInbox } from "@lucide/angular";
56
+ import { PlaceholderComponent } from "@nanahoshi/mona-ui/placeholder";
57
+
58
+ @Component({
59
+ selector: "app-placeholder-empty-state-example",
60
+ imports: [LucideInbox, PlaceholderComponent],
61
+ templateUrl: "./empty-state-example.component.html"
62
+ })
63
+ export class PlaceholderEmptyStateExampleComponent {}
64
+ ```
65
+
66
+ `empty-state-example.component.html`
67
+
68
+ ```html
69
+ <div class="grid max-w-xl gap-4 sm:grid-cols-2">
70
+ <div class="h-40 rounded-md border border-border">
71
+ <mona-placeholder text="No items"></mona-placeholder>
72
+ </div>
73
+ <div class="h-40 rounded-md border border-border">
74
+ <mona-placeholder>
75
+ <div class="flex flex-col items-center gap-2 text-muted-foreground">
76
+ <svg lucideInbox aria-hidden="true" [size]="32"></svg>
77
+ <span>Nothing here yet</span>
78
+ </div>
79
+ </mona-placeholder>
80
+ </div>
81
+ </div>
82
+ ```
83
+
84
+ ### No results
85
+
86
+ Swap between the placeholder and the real content. A placeholder's text is static and isn't announced when it appears, so a live region around it reads it out. For a region that's loading, use `mona-skeleton`.
87
+
88
+ `no-results-example.component.ts`
89
+
90
+ ```typescript
91
+ import { Component, computed, signal } from "@angular/core";
92
+ import { PlaceholderComponent } from "@nanahoshi/mona-ui/placeholder";
93
+ import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
94
+
95
+ const COUNTRIES = ["Argentina", "Canada", "Ghana", "Japan", "Norway", "Portugal"];
96
+
97
+ @Component({
98
+ selector: "app-placeholder-no-results-example",
99
+ imports: [PlaceholderComponent, TextBoxDirective],
100
+ templateUrl: "./no-results-example.component.html"
101
+ })
102
+ export class PlaceholderNoResultsExampleComponent {
103
+ protected readonly query = signal("");
104
+ protected readonly results = computed(() => {
105
+ const query = this.query().trim().toLowerCase();
106
+ return COUNTRIES.filter(country => country.toLowerCase().includes(query));
107
+ });
108
+ }
109
+ ```
110
+
111
+ `no-results-example.component.html`
112
+
113
+ ```html
114
+ <div class="flex max-w-xs flex-col gap-2">
115
+ <label class="text-sm" for="placeholder-country-search">Search countries</label>
116
+ <input #search id="placeholder-country-search" monaTextBox type="search" (input)="query.set(search.value)" />
117
+ <div class="h-48 rounded-md border border-border">
118
+ @if (results().length > 0) {
119
+ <ul class="flex flex-col gap-1 p-3">
120
+ @for (country of results(); track country) {
121
+ <li>{{ country }}</li>
122
+ }
123
+ </ul>
124
+ }
125
+ <div aria-live="polite" [class.h-full]="results().length === 0">
126
+ @if (results().length === 0) {
127
+ <mona-placeholder text="No results"></mona-placeholder>
128
+ }
129
+ </div>
130
+ </div>
131
+ </div>
132
+ ```
133
+
134
+ ## Appearance & Styling
135
+
136
+ The `text` label renders in a muted theme color and in uppercase. It is not interactive and is not announced as a heading.
137
+
138
+ Pass additional Tailwind or custom classes to the host element via the `class` input. They are merged with the component's base classes using `tailwind-merge`, so consumer classes can override the defaults predictably:
139
+
140
+ ```html
141
+ <mona-placeholder text="Empty" class="h-40 border border-dashed border-border rounded-md">
142
+ </mona-placeholder>
143
+ ```
144
+
145
+ `PlaceholderComponent` does not expose a label template or other structural customization point. To render anything beyond a single text label, use projected content mode instead of the `text` input.
146
+
147
+ ## Accessibility
148
+
149
+ `PlaceholderComponent` does not render any ARIA roles or attributes, and the text label is not focusable. It is appropriate for static, non-urgent presentational content.
150
+
151
+ If the placeholder communicates a state change that screen reader users must be notified of (for example, a search that comes back with "No results"), the consumer is responsible for adding an appropriate live region (such as `aria-live`) around the placeholder, since the component does not provide one.
152
+
153
+ ## API
154
+
155
+ Everything below is imported from `@nanahoshi/mona-ui/placeholder`.
156
+
157
+ ### `PlaceholderComponent`
158
+
159
+ **Selector:** `mona-placeholder`
160
+
161
+ #### Inputs
162
+
163
+ | Name | Type | Default | Description |
164
+ | --- | --- | --- | --- |
165
+ | `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. Bind this input with the public `class` alias. |
166
+ | `text` | `string` | `""` | The text to display inside the placeholder. Takes precedence over projected content if both are provided. |
167
+
168
+ ### Types
169
+
170
+ #### `ClassInputType`
171
+
172
+ From `@nanahoshi/mona-ui/common`.
173
+
174
+ ```typescript
175
+ type ClassInputType = string | string[] | Record<string, unknown> | null | undefined;
176
+ ```
@@ -0,0 +1,423 @@
1
+ # Popover
2
+
3
+ > A floating panel anchored to a target and opened by a configurable trigger.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/popover`
6
+
7
+ **Selector:** `mona-popover`
8
+
9
+ `PopoverComponent` displays a floating panel — with an optional title, footer, and projected content — anchored to a target element and opened by a configurable trigger.
10
+
11
+ ## Overview
12
+
13
+ `PopoverComponent` (`mona-popover`) anchors a floating panel — with an optional title, footer, and projected body content — to a `target` element, and opens it via a configurable trigger. It is built on `PopupService` internally.
14
+
15
+ **Use Popover when you need:**
16
+
17
+ - A labeled content panel anchored to a trigger element, with explicit open/close control
18
+ - Title and/or footer regions around free-form projected content
19
+ - A panel the consumer can also open and close imperatively, via `open()` / `close()`
20
+
21
+ **Use a closely related Mona UI component instead when:**
22
+
23
+ - You only need a short hint shown on hover/focus — use `Tooltip`. Popover requires an explicit trigger configuration and renders a title/footer structure that Tooltip does not have.
24
+ - You need a list of actionable menu items — use `PopupMenu` or `ContextMenu`. Popover has no item model, keyboard item navigation, or selection state; its body is arbitrary projected content.
25
+ - You need a modal experience with a focus trap — use `Dialog` or `Window`. Popover moves focus into itself when it opens, but doesn't trap it, and is dismissed by outside click or Escape by default.
26
+ - You need full control over positioning, backdrop, animation, or a popup that is not built from a fixed template — use `Popup` directly. Popover fixes several of `Popup`'s settings (see [Behavior](#behavior)).
27
+
28
+ ## Import & Quick Start
29
+
30
+ ```typescript
31
+ import { PopoverComponent } from "@nanahoshi/mona-ui/popover";
32
+ ```
33
+
34
+ ```html
35
+ <button #anchor type="button">Open popover</button>
36
+ <mona-popover [target]="anchor" title="Title">
37
+ <p class="p-2">Popover content</p>
38
+ </mona-popover>
39
+ ```
40
+
41
+ `target` accepts a template reference variable (as above, resolving to the native element), an `ElementRef`, or a plain `Element`. The default `trigger` is `"click"`.
42
+
43
+ To call `open()` / `close()` from the template, capture a reference with `exportAs="monaPopover"`:
44
+
45
+ ```html
46
+ <mona-popover #p="monaPopover" [target]="anchor">
47
+ <p class="p-2">Popover content</p>
48
+ </mona-popover>
49
+ <button type="button" (click)="p.open()">Open</button>
50
+ <button type="button" (click)="p.close()">Close</button>
51
+ ```
52
+
53
+ ## Anatomy
54
+
55
+ Content placed inside `<mona-popover>...</mona-popover>` — other than the template directives below — becomes the panel's body content.
56
+
57
+ | Directive selector | Purpose |
58
+ |------------------------------------------|------------------------------------------------------------------------------------------------------|
59
+ | `ng-template[monaPopoverTitleTemplate]` | Replaces the plain-text `title` in the header. Takes precedence over `title` when both are provided. |
60
+ | `ng-template[monaPopoverFooterTemplate]` | Adds a footer region below the body content. |
61
+
62
+ Neither directive exposes a template context (no `let-` variables).
63
+
64
+ ```html
65
+ <mona-popover [target]="anchor">
66
+ <ng-template monaPopoverTitleTemplate>
67
+ <div class="flex items-center justify-between p-2">
68
+ <span>Custom Title</span>
69
+ </div>
70
+ </ng-template>
71
+ <p class="p-2">Body content</p>
72
+ <ng-template monaPopoverFooterTemplate>
73
+ <div class="p-2 border-t border-t-border">Footer</div>
74
+ </ng-template>
75
+ </mona-popover>
76
+ ```
77
+
78
+ The header row — and the rounded top corners that go with it — only renders when `title` is non-empty or a title template is projected. The footer region only renders when a footer template is projected.
79
+
80
+ ## Examples
81
+
82
+ ### Click trigger (default)
83
+
84
+ Clicking the target toggles the popover — a second click on the same target closes it instead of opening a duplicate. The footer's button closes it through the `monaPopover` reference.
85
+
86
+ `basic-example.component.ts`
87
+
88
+ ```typescript
89
+ import { Component } from "@angular/core";
90
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
91
+ import { PopoverComponent, PopoverFooterTemplateDirective } from "@nanahoshi/mona-ui/popover";
92
+
93
+ @Component({
94
+ selector: "app-popover-basic-example",
95
+ imports: [ButtonDirective, PopoverComponent, PopoverFooterTemplateDirective],
96
+ templateUrl: "./basic-example.component.html"
97
+ })
98
+ export class PopoverBasicExampleComponent {}
99
+ ```
100
+
101
+ `basic-example.component.html`
102
+
103
+ ```html
104
+ <button #details monaButton type="button">Order details</button>
105
+
106
+ <mona-popover #popover="monaPopover" position="bottom" title="Order #1042" [target]="details">
107
+ <dl class="grid w-64 grid-cols-2 gap-1 p-2 text-sm">
108
+ <dt>Placed</dt>
109
+ <dd>12 March</dd>
110
+ <dt>Items</dt>
111
+ <dd>3</dd>
112
+ <dt>Total</dt>
113
+ <dd>€84.50</dd>
114
+ </dl>
115
+ <ng-template monaPopoverFooterTemplate>
116
+ <div class="flex justify-end border-t border-t-border p-2">
117
+ <button monaButton type="button" (click)="popover.close()">Close</button>
118
+ </div>
119
+ </ng-template>
120
+ </mona-popover>
121
+ ```
122
+
123
+ ### Hover trigger
124
+
125
+ `hover-example.component.ts`
126
+
127
+ ```typescript
128
+ import { Component } from "@angular/core";
129
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
130
+ import { PopoverComponent } from "@nanahoshi/mona-ui/popover";
131
+
132
+ @Component({
133
+ selector: "app-popover-hover-example",
134
+ imports: [ButtonDirective, PopoverComponent],
135
+ templateUrl: "./hover-example.component.html"
136
+ })
137
+ export class PopoverHoverExampleComponent {}
138
+ ```
139
+
140
+ `hover-example.component.html`
141
+
142
+ ```html
143
+ <p class="text-sm">
144
+ Reviewed by
145
+ <button #reviewer monaButton look="link" type="button">Grace Hopper</button>
146
+ </p>
147
+
148
+ <mona-popover position="end" title="Grace Hopper" trigger="hover" [displayArrow]="true" [target]="reviewer">
149
+ <p class="w-56 p-2 text-sm">Platform team lead. Reviews changes to the build and release pipeline.</p>
150
+ </mona-popover>
151
+ ```
152
+
153
+ A hover popover opens when the pointer moves onto the target or keyboard focus enters it. It closes once both have left the target and the panel, after a grace of about 100 ms that lets the pointer move onto the panel. Touch pointers don't open it. A hover popover doesn't take focus when it opens, unless `autoFocus` is set.
154
+
155
+ ### Manual trigger
156
+
157
+ ```html
158
+ <mona-popover #p="monaPopover" [target]="anchor" trigger="none">
159
+ <p class="p-2">Opened and closed only through p.open() / p.close().</p>
160
+ </mona-popover>
161
+ <button type="button" (click)="p.open()">Open</button>
162
+ ```
163
+
164
+ ### Position and arrow
165
+
166
+ The hover example above opens after its target in the reading direction (`position="end"`), with `[displayArrow]="true"`. `position` is `"top"` (default), `"bottom"`, `"left"`, `"right"`, `"start"` or `"end"`. `left` and `right` are physical sides in both directions; `start` and `end` follow the text direction. When there isn't room, the popover flips to the opposite side, and its arrow follows.
167
+
168
+ ### Popover without a visible title
169
+
170
+ `no-title-example.component.ts`
171
+
172
+ ```typescript
173
+ import { Component, computed, signal } from "@angular/core";
174
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
175
+ import { CheckBoxComponent } from "@nanahoshi/mona-ui/check-box";
176
+ import { PopoverComponent } from "@nanahoshi/mona-ui/popover";
177
+
178
+ @Component({
179
+ selector: "app-popover-no-title-example",
180
+ imports: [ButtonDirective, CheckBoxComponent, PopoverComponent],
181
+ templateUrl: "./no-title-example.component.html"
182
+ })
183
+ export class PopoverNoTitleExampleComponent {
184
+ protected readonly activeCount = computed(() => [this.open(), this.assignedToMe()].filter(Boolean).length);
185
+ protected readonly assignedToMe = signal(false);
186
+ protected readonly open = signal(true);
187
+ }
188
+ ```
189
+
190
+ `no-title-example.component.html`
191
+
192
+ ```html
193
+ <button #filters monaButton type="button">Filters ({{ activeCount() }})</button>
194
+
195
+ <mona-popover aria-label="Filters" position="bottom" [target]="filters">
196
+ <div class="flex flex-col gap-2 p-3">
197
+ <mona-check-box label="Open issues only" [(checked)]="open" />
198
+ <mona-check-box label="Assigned to me" [(checked)]="assignedToMe" />
199
+ </div>
200
+ </mona-popover>
201
+ ```
202
+
203
+ A popover is a dialog, and needs a name: a `title`, a title template, or `aria-label`. In dev mode, a popover that opens without one logs a warning.
204
+
205
+ ### Preventing a close
206
+
207
+ ```typescript
208
+ import type { PopoverHideEvent } from "@nanahoshi/mona-ui/popover";
209
+
210
+ protected onHide(event: PopoverHideEvent): void {
211
+ if (!this.canClose()) {
212
+ event.preventDefault();
213
+ }
214
+ }
215
+ ```
216
+
217
+ ```html
218
+ <mona-popover [target]="anchor" (hide)="onHide($event)">
219
+ <p class="p-2">Popover content</p>
220
+ </mona-popover>
221
+ ```
222
+
223
+ `preventDefault()` on the `hide` event cancels the close regardless of what triggered it — a second click on the target, a direct `close()` call, an outside click, or Escape. The popover stays open and its internal open/closed tracking remains consistent in every case.
224
+
225
+ ## Behavior
226
+
227
+ **The triggering DOM event keeps its default action.** A link, a checkbox or a submit button can be the target, and still navigates, toggles or submits. The one exception is `trigger="contextmenu"`, whose default (the browser's own menu) would cover the popover.
228
+
229
+ **`trigger` accepts more than the three documented values.** `PopoverTrigger` is `"click" | "hover" | "none"` plus any other string. Any DOM event name dispatched on the target (for example `"contextmenu"`) toggles the popover the same way `"click"` does. Only `"hover"` gets pointer and focus handling, and only `"none"` disables automatic triggering.
230
+
231
+ **Outside click and Escape close the popover by default.** Set `closeOnOutsideClick` or `closeOnEscape` to `false` to turn either off. A click on the target itself is never an outside click.
232
+
233
+ **Positioning flips.** The popover opens on the side `position` names, and flips to the opposite side when there isn't room. It is then pushed back into the viewport if it still overflows.
234
+
235
+ **Several `Popup` settings are fixed, not exposed as Popover inputs:** there is no backdrop, the animation is always the fade preset, and focus is restored to the target on close only if the target held focus when the popover opened. Use `Popup` directly if you need to configure these.
236
+
237
+ **Calling `open()` while already open is a no-op.** It only has an effect when the popover is currently closed.
238
+
239
+ **`open()` does not emit `show`.** `show` is only emitted by the trigger-driven open path, so it can be prevented. `shown` is emitted once the popover has opened, however it was opened. `close()` — and a trigger-driven toggle-close — both route through the same popup-level close handling, which emits `hide` exactly once per close attempt, regardless of what initiated it.
240
+
241
+ **The component's internal open/closed tracking only updates once the popup has actually closed.** Calling `close()` does not clear it immediately; it is cleared after the popup finishes closing. If a `hide` listener calls `event.preventDefault()`, the popup stays open and the internal tracking still reflects "open," so a subsequent `open()` call remains a correct no-op instead of creating a duplicate popup.
242
+
243
+ **Destroying the popover closes it**, without emitting `hide` or `hidden`, and removes the attributes it set on the target. Changing `target` moves those attributes to the new target.
244
+
245
+ - `"click"`, `"hover"`, and `"none"` get autocomplete; any other string is also accepted and used as a raw DOM event name (see Technical & Behavior Notes).
246
+
247
+ ## Accessibility
248
+
249
+ ### Keyboard
250
+
251
+ | Key | Action |
252
+ |--------|-----------------------------------------------------------------------------------------------------|
253
+ | Escape | Closes the popover, unless `closeOnEscape` is `false`. Focus returns to the target if it was there. |
254
+ | Tab | Moves through the popover's content, and on past it. Focus isn't trapped. |
255
+
256
+ If `target` is a native interactive element (for example a `<button>`), its own keyboard activation (Enter / Space) already dispatches the `click` event that the default trigger listens for.
257
+
258
+ ### ARIA
259
+
260
+ **Target element** (the element bound to `target`):
261
+
262
+ | Attribute | When present | Value |
263
+ |-----------------|---------------------------|------------------------------------------|
264
+ | `aria-haspopup` | From the start | `"dialog"` |
265
+ | `aria-expanded` | From the start | `"true"` while open, `"false"` otherwise |
266
+ | `aria-controls` | While the popover is open | The panel's auto-generated id |
267
+
268
+ All three are removed when the popover is destroyed or its `target` changes.
269
+
270
+ **Panel:**
271
+
272
+ | Attribute | When present | Value |
273
+ |-------------------|------------------------------------------------------------|------------------------------------------------------|
274
+ | `role` | Always | `"dialog"` |
275
+ | `id` | Always | Auto-generated, matches the target's `aria-controls` |
276
+ | `aria-labelledby` | When `title` is non-empty or a title template is projected | The header element's auto-generated id |
277
+ | `aria-label` | When there's no title, and `aria-label` is set | `aria-label` |
278
+ | `tabindex` | Always | `"-1"`, so the panel itself can take focus |
279
+
280
+ ### Focus
281
+
282
+ When a popover opens, focus moves to its first focusable element, or to the panel when it has none. A hover popover doesn't take focus. Set `autoFocus` to choose either way.
283
+
284
+ Popover is non-modal and doesn't trap focus: Tab moves on past its content, and focus can leave it freely. On close, focus returns to the target if the target held focus when the popover opened.
285
+
286
+ **Consumer responsibilities:**
287
+
288
+ - Provide an accessible name for the `target` element itself (visible text, or its own `aria-label`) — Popover does not add one.
289
+ - Name the popover with `title`, a title template, or `aria-label`.
290
+ - `role="dialog"` is rendered without `aria-modal`. If your use case requires a modal, focus-trapped experience, use `Dialog` or `Window` instead.
291
+
292
+ ## API
293
+
294
+ Everything below is imported from `@nanahoshi/mona-ui/popover`.
295
+
296
+ ### `PopoverComponent`
297
+
298
+ **Selector:** `mona-popover`
299
+ **Exported as:** `monaPopover`
300
+
301
+ #### Inputs
302
+
303
+ | Name | Type | Default | Description |
304
+ | --- | --- | --- | --- |
305
+ | `aria-label` | `string \| undefined` | `undefined` | Accessible name for the popover when it has no `title` or title template. |
306
+ | `autoFocus` | `boolean \| undefined` | `undefined` | Whether focus moves into the popover when it opens: to its first focusable element, or to the popover itself. Defaults to `true`, except for the `hover` trigger. |
307
+ | `closeOnEscape` | `boolean` | `true` | Whether pressing Escape closes the popover. |
308
+ | `closeOnOutsideClick` | `boolean` | `true` | Whether a click outside the popover and its target closes it. |
309
+ | `displayArrow` | `boolean` | `false` | Display the arrow of the popover. |
310
+ | `position` | `PopoverPosition` | `"top"` | The side of the target the popover opens on. `left` and `right` are physical; `start` and `end` follow the text direction. It flips to the opposite side when there isn't room. |
311
+ | `rounded` | `"large" \| "medium" \| "none" \| "small"` | `"medium"` | The border radius of the popover. |
312
+ | `target` (required) | `Element \| ElementRef` | — | The target element or ElementRef to which the popover is attached. |
313
+ | `title` | `string` | `""` | The title of the popover. |
314
+ | `trigger` | `PopoverTrigger` | `"click"` | The trigger that opens/closes the popover. "click" toggles on click, "hover" opens while the pointer is on the target or the popover, or focus is on the target, "none" disables automatic triggering (use `open()`/`close()` instead). Any other DOM event name is also accepted and used as-is. |
315
+
316
+ #### Outputs
317
+
318
+ | Name | Type | Description |
319
+ | --- | --- | --- |
320
+ | `hidden` | `void` | Emits when the popover is hidden. |
321
+ | `hide` | `PopoverHideEvent` | Emits when the popover is about to be closed. This event is preventable. |
322
+ | `show` | `PopoverShowEvent` | Emits when the popover is about to be shown. This event is preventable. |
323
+ | `shown` | `PopoverShownEvent` | Emits once the popover has opened. |
324
+
325
+ #### Methods
326
+
327
+ | Signature | Description |
328
+ | --- | --- |
329
+ | `close(): void` | Closes the popover if one is currently open. Emits `hide` and respects `preventDefault()` — if canceled, the popup stays open and the component's internal state remains consistent with that. |
330
+ | `open(): void` | Opens the popover directly. No-op if it is already open. Does not emit `show`; emits `shown` once open. |
331
+
332
+ ### `PopoverFooterTemplateDirective`
333
+
334
+ Marks an `ng-template` as the popover's custom footer content.
335
+
336
+ **Selector:** `ng-template[monaPopoverFooterTemplate]`
337
+
338
+ ### `PopoverTitleTemplateDirective`
339
+
340
+ Marks an `ng-template` as the popover's custom title content.
341
+
342
+ **Selector:** `ng-template[monaPopoverTitleTemplate]`
343
+
344
+ ### `PopoverHideEvent`
345
+
346
+ **Extends:** `PreventableEvent`
347
+
348
+ #### Properties
349
+
350
+ | Name | Type |
351
+ | --- | --- |
352
+ | `popupRef` (read-only) | `PopupRef` |
353
+ | `target` (read-only) | `Element` |
354
+
355
+ ### `PopoverShowEvent`
356
+
357
+ **Extends:** `PreventableEvent`
358
+
359
+ #### Properties
360
+
361
+ | Name | Type |
362
+ | --- | --- |
363
+ | `target` (read-only) | `Element` |
364
+
365
+ ### `PopoverShownEvent`
366
+
367
+ #### Properties
368
+
369
+ | Name | Type |
370
+ | --- | --- |
371
+ | `popupRef` (read-only) | `PopupRef` |
372
+ | `target` (read-only) | `Element` |
373
+
374
+ ### Types
375
+
376
+ #### `OverlaySide`
377
+
378
+ A side of the anchor. `start` and `end` follow the direction.
379
+
380
+ ```typescript
381
+ type OverlaySide = "bottom" | "end" | "left" | "right" | "start" | "top";
382
+ ```
383
+
384
+ #### `PopoverPosition`
385
+
386
+ The side of its target a popover opens on. `left` and `right` are physical in every direction; `start` and `end`
387
+ follow the text direction.
388
+
389
+ ```typescript
390
+ type PopoverPosition = OverlaySide;
391
+ ```
392
+
393
+ #### `PopoverTrigger`
394
+
395
+ The trigger event for showing/hiding a popover.
396
+ "click" toggles the popover on click, "hover" opens on pointer enter and
397
+ closes on pointer leave, and "none" disables automatic triggering so the
398
+ popover can only be controlled via its `open()`/`close()` methods.
399
+ Any other DOM event name is also accepted and used as-is to open the popover.
400
+
401
+ ```typescript
402
+ type PopoverTrigger = "click" | "hover" | "none" | (string & {});
403
+ ```
404
+
405
+ #### `PreventableEvent`
406
+
407
+ From `@nanahoshi/mona-ui/common`.
408
+
409
+ **Type parameters:** `E extends Event = Event`
410
+
411
+ | Name | Type | Description |
412
+ | --- | --- | --- |
413
+ | `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
414
+ | `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
415
+
416
+ **Methods**
417
+
418
+ | Signature | Description |
419
+ | --- | --- |
420
+ | `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
421
+ | `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
422
+
423
+ **Documented elsewhere:** [`PopupRef`](popup.md)