@ui-sdk/vue 0.0.0-stage → 0.1.0-beta.1

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 (262) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +10 -2
  3. package/dist/accordion.d.ts +561 -0
  4. package/dist/accordion.js +24 -0
  5. package/dist/agent.d.ts +2 -0
  6. package/dist/agent.js +7 -0
  7. package/dist/alert-dialog.d.ts +231 -0
  8. package/dist/alert-dialog.js +33 -0
  9. package/dist/async-options.d.ts +18 -0
  10. package/dist/async-options.js +40 -0
  11. package/dist/autocomplete.d.ts +384 -0
  12. package/dist/autocomplete.js +344 -0
  13. package/dist/avatar.d.ts +40 -0
  14. package/dist/avatar.js +28 -0
  15. package/dist/button.d.ts +52 -0
  16. package/dist/button.js +43 -0
  17. package/dist/calendar-context.d.ts +10 -0
  18. package/dist/calendar-context.js +7 -0
  19. package/dist/calendar.d.ts +311 -0
  20. package/dist/calendar.js +349 -0
  21. package/dist/carousel.d.ts +236 -0
  22. package/dist/carousel.js +204 -0
  23. package/dist/checkbox.d.ts +211 -0
  24. package/dist/checkbox.js +151 -0
  25. package/dist/children.d.ts +41 -0
  26. package/dist/children.js +135 -0
  27. package/dist/collapsible.d.ts +54 -0
  28. package/dist/collapsible.js +18 -0
  29. package/dist/color-picker.d.ts +187 -0
  30. package/dist/color-picker.js +158 -0
  31. package/dist/color.d.ts +2 -0
  32. package/dist/color.js +21 -0
  33. package/dist/combobox.d.ts +517 -0
  34. package/dist/combobox.js +531 -0
  35. package/dist/command.d.ts +322 -0
  36. package/dist/command.js +345 -0
  37. package/dist/controller-target.d.ts +49 -0
  38. package/dist/controller-target.js +112 -0
  39. package/dist/create-parts.d.ts +126 -0
  40. package/dist/create-parts.js +206 -0
  41. package/dist/date-input.d.ts +133 -0
  42. package/dist/date-input.js +31 -0
  43. package/dist/date-picker.d.ts +328 -0
  44. package/dist/date-picker.js +354 -0
  45. package/dist/date.d.ts +2 -0
  46. package/dist/date.js +59 -0
  47. package/dist/dialog-parts.d.ts +259 -0
  48. package/dist/dialog-parts.js +300 -0
  49. package/dist/dialog.d.ts +251 -0
  50. package/dist/dialog.js +25 -0
  51. package/dist/drawer.d.ts +304 -0
  52. package/dist/drawer.js +373 -0
  53. package/dist/editor-context.d.ts +4 -0
  54. package/dist/editor-context.js +5 -0
  55. package/dist/field-context.d.ts +26 -0
  56. package/dist/field-context.js +44 -0
  57. package/dist/field.d.ts +154 -0
  58. package/dist/field.js +240 -0
  59. package/dist/file-input.d.ts +212 -0
  60. package/dist/file-input.js +255 -0
  61. package/dist/form-inputs.d.ts +16 -0
  62. package/dist/form-inputs.js +25 -0
  63. package/dist/gesture.d.ts +1 -0
  64. package/dist/gesture.js +15 -0
  65. package/dist/history.d.ts +2 -0
  66. package/dist/history.js +11 -0
  67. package/dist/hover-card.d.ts +137 -0
  68. package/dist/hover-card.js +153 -0
  69. package/dist/image-cropper.d.ts +74 -0
  70. package/dist/image-cropper.js +36 -0
  71. package/dist/image.d.ts +2 -0
  72. package/dist/image.js +5 -0
  73. package/dist/index.d.ts +59 -0
  74. package/dist/index.js +60 -0
  75. package/dist/input.d.ts +120 -0
  76. package/dist/input.js +73 -0
  77. package/dist/item-icon.d.ts +34 -0
  78. package/dist/item-icon.js +63 -0
  79. package/dist/label.d.ts +16 -0
  80. package/dist/label.js +8 -0
  81. package/dist/lifecycle.d.ts +11 -0
  82. package/dist/lifecycle.js +91 -0
  83. package/dist/list-items.d.ts +38 -0
  84. package/dist/list-items.js +59 -0
  85. package/dist/list-text.d.ts +7 -0
  86. package/dist/list-text.js +15 -0
  87. package/dist/listbox.d.ts +273 -0
  88. package/dist/listbox.js +126 -0
  89. package/dist/menu.d.ts +678 -0
  90. package/dist/menu.js +607 -0
  91. package/dist/menubar-context.d.ts +5 -0
  92. package/dist/menubar-context.js +5 -0
  93. package/dist/menubar.d.ts +61 -0
  94. package/dist/menubar.js +48 -0
  95. package/dist/meter.d.ts +41 -0
  96. package/dist/meter.js +37 -0
  97. package/dist/navigation-menu.d.ts +228 -0
  98. package/dist/navigation-menu.js +195 -0
  99. package/dist/number-input.d.ts +176 -0
  100. package/dist/number-input.js +231 -0
  101. package/dist/number.d.ts +2 -0
  102. package/dist/number.js +39 -0
  103. package/dist/nuxt/entries.json +977 -0
  104. package/dist/nuxt/module.d.ts +18 -0
  105. package/dist/nuxt/module.js +31 -0
  106. package/dist/nuxt/registrations.d.ts +22 -0
  107. package/dist/nuxt/registrations.js +22 -0
  108. package/dist/observe.d.ts +2 -0
  109. package/dist/observe.js +7 -0
  110. package/dist/otp-input.d.ts +142 -0
  111. package/dist/otp-input.js +130 -0
  112. package/dist/overlays.d.ts +40 -0
  113. package/dist/overlays.js +118 -0
  114. package/dist/pagination.d.ts +201 -0
  115. package/dist/pagination.js +146 -0
  116. package/dist/password-input.d.ts +144 -0
  117. package/dist/password-input.js +134 -0
  118. package/dist/popover.d.ts +211 -0
  119. package/dist/popover.js +258 -0
  120. package/dist/popup.d.ts +60 -0
  121. package/dist/popup.js +89 -0
  122. package/dist/preferences.d.ts +44 -0
  123. package/dist/preferences.js +102 -0
  124. package/dist/primitive.d.ts +2 -0
  125. package/dist/primitive.js +11 -0
  126. package/dist/progress.d.ts +41 -0
  127. package/dist/progress.js +37 -0
  128. package/dist/radio.d.ts +164 -0
  129. package/dist/radio.js +145 -0
  130. package/dist/rating.d.ts +149 -0
  131. package/dist/rating.js +146 -0
  132. package/dist/renderless.d.ts +4 -0
  133. package/dist/renderless.js +28 -0
  134. package/dist/resizable.d.ts +54 -0
  135. package/dist/resizable.js +22 -0
  136. package/dist/scroll-area.d.ts +72 -0
  137. package/dist/scroll-area.js +77 -0
  138. package/dist/segmented-control.d.ts +151 -0
  139. package/dist/segmented-control.js +110 -0
  140. package/dist/segmented-input.d.ts +76 -0
  141. package/dist/segmented-input.js +115 -0
  142. package/dist/select.d.ts +458 -0
  143. package/dist/select.js +468 -0
  144. package/dist/separator.d.ts +14 -0
  145. package/dist/separator.js +8 -0
  146. package/dist/shortcuts.d.ts +32 -0
  147. package/dist/shortcuts.js +56 -0
  148. package/dist/slider.d.ts +65 -0
  149. package/dist/slider.js +194 -0
  150. package/dist/switch.d.ts +103 -0
  151. package/dist/switch.js +71 -0
  152. package/dist/tabs.d.ts +338 -0
  153. package/dist/tabs.js +27 -0
  154. package/dist/text-control.d.ts +89 -0
  155. package/dist/text-control.js +51 -0
  156. package/dist/text-match.d.ts +2 -0
  157. package/dist/text-match.js +7 -0
  158. package/dist/textarea.d.ts +106 -0
  159. package/dist/textarea.js +68 -0
  160. package/dist/time-input.d.ts +131 -0
  161. package/dist/time-input.js +32 -0
  162. package/dist/timeline.d.ts +81 -0
  163. package/dist/timeline.js +30 -0
  164. package/dist/toast-parts.d.ts +203 -0
  165. package/dist/toast-parts.js +270 -0
  166. package/dist/toast.d.ts +2 -0
  167. package/dist/toast.js +21 -0
  168. package/dist/toggle-props.d.ts +22 -0
  169. package/dist/toggle-props.js +14 -0
  170. package/dist/toggle.d.ts +199 -0
  171. package/dist/toggle.js +129 -0
  172. package/dist/token-input.d.ts +136 -0
  173. package/dist/token-input.js +214 -0
  174. package/dist/toolbar-context.d.ts +7 -0
  175. package/dist/toolbar-context.js +20 -0
  176. package/dist/toolbar.d.ts +120 -0
  177. package/dist/toolbar.js +77 -0
  178. package/dist/tooltip.d.ts +160 -0
  179. package/dist/tooltip.js +224 -0
  180. package/dist/tree.d.ts +300 -0
  181. package/dist/tree.js +209 -0
  182. package/dist/trigger-menu.d.ts +452 -0
  183. package/dist/trigger-menu.js +254 -0
  184. package/dist/use-primitive.d.ts +132 -0
  185. package/dist/use-primitive.js +462 -0
  186. package/dist/waterfall.d.ts +201 -0
  187. package/dist/waterfall.js +171 -0
  188. package/docs/README.md +89 -0
  189. package/docs/agents.md +1523 -0
  190. package/docs/components/accordion.md +1369 -0
  191. package/docs/components/alert-dialog.md +799 -0
  192. package/docs/components/autocomplete.md +1857 -0
  193. package/docs/components/avatar.md +272 -0
  194. package/docs/components/button.md +435 -0
  195. package/docs/components/calendar.md +1589 -0
  196. package/docs/components/carousel.md +1171 -0
  197. package/docs/components/checkbox.md +1008 -0
  198. package/docs/components/collapsible.md +536 -0
  199. package/docs/components/color-picker.md +706 -0
  200. package/docs/components/combobox.md +3504 -0
  201. package/docs/components/command.md +1481 -0
  202. package/docs/components/date-input.md +536 -0
  203. package/docs/components/date-picker.md +1244 -0
  204. package/docs/components/dialog.md +1397 -0
  205. package/docs/components/drawer.md +1166 -0
  206. package/docs/components/field.md +538 -0
  207. package/docs/components/file-input.md +611 -0
  208. package/docs/components/hover-card.md +505 -0
  209. package/docs/components/image-cropper.md +556 -0
  210. package/docs/components/input.md +306 -0
  211. package/docs/components/label.md +203 -0
  212. package/docs/components/listbox.md +1004 -0
  213. package/docs/components/menu.md +1229 -0
  214. package/docs/components/menubar.md +443 -0
  215. package/docs/components/meter.md +315 -0
  216. package/docs/components/navigation-menu.md +1523 -0
  217. package/docs/components/number-input.md +1029 -0
  218. package/docs/components/otp-input.md +512 -0
  219. package/docs/components/pagination.md +613 -0
  220. package/docs/components/password-input.md +649 -0
  221. package/docs/components/popover.md +1448 -0
  222. package/docs/components/preferences.md +208 -0
  223. package/docs/components/progress.md +423 -0
  224. package/docs/components/radio.md +785 -0
  225. package/docs/components/rating.md +416 -0
  226. package/docs/components/resizable.md +910 -0
  227. package/docs/components/scroll-area.md +915 -0
  228. package/docs/components/segmented-control.md +435 -0
  229. package/docs/components/select.md +2015 -0
  230. package/docs/components/separator.md +229 -0
  231. package/docs/components/slider.md +1084 -0
  232. package/docs/components/switch.md +565 -0
  233. package/docs/components/tabs.md +944 -0
  234. package/docs/components/textarea.md +299 -0
  235. package/docs/components/time-input.md +224 -0
  236. package/docs/components/timeline.md +654 -0
  237. package/docs/components/toast.md +1224 -0
  238. package/docs/components/toggle.md +500 -0
  239. package/docs/components/token-input.md +953 -0
  240. package/docs/components/toolbar.md +739 -0
  241. package/docs/components/tooltip.md +818 -0
  242. package/docs/components/tree.md +1306 -0
  243. package/docs/components/trigger-menu.md +1223 -0
  244. package/docs/components/waterfall.md +717 -0
  245. package/docs/controllers.md +71 -0
  246. package/docs/core.md +8027 -0
  247. package/docs/custom-parts.md +89 -0
  248. package/docs/first-component.md +83 -0
  249. package/docs/forms.md +122 -0
  250. package/docs/installation.md +72 -0
  251. package/docs/introduction.md +32 -0
  252. package/docs/lists-and-menus.md +122 -0
  253. package/docs/llms.txt +1502 -0
  254. package/docs/parts-and-composition.md +85 -0
  255. package/docs/popups.md +108 -0
  256. package/docs/rendering.md +56 -0
  257. package/docs/server-rendering.md +180 -0
  258. package/docs/state-and-events.md +100 -0
  259. package/docs/styling-and-animation.md +148 -0
  260. package/docs/utilities/async-options.md +348 -0
  261. package/docs/utilities/shortcuts.md +159 -0
  262. package/package.json +352 -3
@@ -0,0 +1,443 @@
1
+ # Menubar
2
+
3
+ Move between an application’s menus with one tab stop.
4
+
5
+ Wrap a few [Menus](./menu.md) in a Menubar to connect their triggers. Tab enters the bar once; arrow keys move between menus, and pointing at another trigger switches an open menu.
6
+
7
+ ```vue title="demo.vue"
8
+ <script setup lang="ts">
9
+ import { CheckIcon, ChevronRightIcon } from "@lucide/vue"
10
+ import {
11
+ Menu,
12
+ MenuCheckboxItem,
13
+ MenuContent,
14
+ MenuGroupLabel,
15
+ MenuItem,
16
+ MenuItemIndicator,
17
+ MenuRadioGroup,
18
+ MenuRadioItem,
19
+ MenuSeparator,
20
+ MenuSub,
21
+ MenuSubContent,
22
+ MenuSubTrigger,
23
+ MenuTrigger,
24
+ } from "@ui-sdk/vue/menu"
25
+ import { Menubar } from "@ui-sdk/vue/menubar"
26
+ import { useLog } from "./log"
27
+
28
+ const recent = ["Q3 roadmap", "Launch checklist", "Offsite notes"]
29
+ const formats = ["PDF", "Markdown", "HTML"]
30
+ const appearances = ["Light", "Dark", "System"]
31
+
32
+ const log = useLog()
33
+ const chose = (value: string) => log(`Chose ${value}`)
34
+ </script>
35
+
36
+ <template>
37
+ <Menubar>
38
+ <Menu @action="chose">
39
+ <MenuTrigger>File</MenuTrigger>
40
+ <MenuContent>
41
+ <MenuItem value="New document" shortcut="mod+n">New Document</MenuItem>
42
+ <MenuItem value="Open" shortcut="mod+o">Open…</MenuItem>
43
+ <MenuSub>
44
+ <MenuSubTrigger>
45
+ Open Recent
46
+ <ChevronRightIcon aria-hidden="true" />
47
+ </MenuSubTrigger>
48
+ <MenuSubContent>
49
+ <MenuItem v-for="name in recent" :key="name" :value="name">{{
50
+ name
51
+ }}</MenuItem>
52
+ </MenuSubContent>
53
+ </MenuSub>
54
+ <MenuSeparator />
55
+ <MenuSub>
56
+ <MenuSubTrigger>
57
+ Export
58
+ <ChevronRightIcon aria-hidden="true" />
59
+ </MenuSubTrigger>
60
+ <MenuSubContent>
61
+ <MenuItem
62
+ v-for="format in formats"
63
+ :key="format"
64
+ :value="`Export as ${format}`"
65
+ >
66
+ {{ format }}
67
+ </MenuItem>
68
+ </MenuSubContent>
69
+ </MenuSub>
70
+ <MenuItem value="Print" shortcut="mod+p">Print…</MenuItem>
71
+ </MenuContent>
72
+ </Menu>
73
+ <Menu @action="chose">
74
+ <MenuTrigger>Edit</MenuTrigger>
75
+ <MenuContent>
76
+ <MenuItem value="Undo" shortcut="mod+z" disabled>Undo</MenuItem>
77
+ <MenuItem value="Redo" shortcut="mod+shift+z">Redo</MenuItem>
78
+ <MenuSeparator />
79
+ <MenuItem value="Cut" shortcut="mod+x">Cut</MenuItem>
80
+ <MenuItem value="Copy" shortcut="mod+c">Copy</MenuItem>
81
+ <MenuItem value="Paste" shortcut="mod+v">Paste</MenuItem>
82
+ <MenuSeparator />
83
+ <MenuItem value="Find" shortcut="mod+f">Find…</MenuItem>
84
+ </MenuContent>
85
+ </Menu>
86
+ <Menu
87
+ @checked-change="
88
+ (checked, details) => log(`${details.value} ${checked ? 'on' : 'off'}`)
89
+ "
90
+ @value-change="(value) => log(`${value} appearance`)"
91
+ >
92
+ <MenuTrigger>View</MenuTrigger>
93
+ <MenuContent>
94
+ <MenuCheckboxItem value="Ruler">
95
+ <MenuItemIndicator>
96
+ <CheckIcon aria-hidden="true" />
97
+ </MenuItemIndicator>
98
+ Show Ruler
99
+ </MenuCheckboxItem>
100
+ <MenuCheckboxItem value="Word count" default-checked>
101
+ <MenuItemIndicator>
102
+ <CheckIcon aria-hidden="true" />
103
+ </MenuItemIndicator>
104
+ Show Word Count
105
+ </MenuCheckboxItem>
106
+ <MenuSeparator />
107
+ <MenuRadioGroup default-value="System">
108
+ <MenuGroupLabel>Appearance</MenuGroupLabel>
109
+ <MenuRadioItem
110
+ v-for="appearance in appearances"
111
+ :key="appearance"
112
+ :value="appearance"
113
+ >
114
+ <MenuItemIndicator />
115
+ {{ appearance }}
116
+ </MenuRadioItem>
117
+ </MenuRadioGroup>
118
+ </MenuContent>
119
+ </Menu>
120
+ </Menubar>
121
+ </template>
122
+ ```
123
+
124
+ Tab into the bar and use Left and Right to choose a menu, or point at another trigger once one is open. File has submenus, Edit has shortcuts, and View has checkboxes and an appearance choice. The console logs each one.
125
+
126
+ ## Installation
127
+
128
+ ```bash
129
+ npm install @ui-sdk/vue @ui-sdk/core
130
+ ```
131
+
132
+ ## Composition
133
+
134
+ Use the following composition to build a `Menubar`:
135
+
136
+ ```text
137
+ Menubar
138
+ ├── Menu
139
+ │ ├── MenuTrigger
140
+ │ └── MenuContent
141
+ │ ├── MenuItem
142
+ │ └── MenuItem
143
+ └── Menu
144
+ ├── MenuTrigger
145
+ └── MenuContent
146
+ ├── MenuItem
147
+ └── MenuItem
148
+ ```
149
+
150
+ Each Menu joins its surrounding Menubar automatically. There are no separate menubar trigger or item components. Name the bar with `aria-label` when people need to distinguish it from another one.
151
+
152
+ ## Usage
153
+
154
+ Import the parts and put them together:
155
+
156
+ ```vue
157
+ <script setup lang="ts">
158
+ import { Menu, MenuContent, MenuItem, MenuTrigger } from "@ui-sdk/vue/menu"
159
+ import { Menubar } from "@ui-sdk/vue/menubar"
160
+ </script>
161
+
162
+ <template>
163
+ <Menubar aria-label="Application">
164
+ <Menu>
165
+ <MenuTrigger>File</MenuTrigger>
166
+ <MenuContent>
167
+ <MenuItem>New file</MenuItem>
168
+ <MenuItem>Open file</MenuItem>
169
+ </MenuContent>
170
+ </Menu>
171
+ <Menu>
172
+ <MenuTrigger>Edit</MenuTrigger>
173
+ <MenuContent>
174
+ <MenuItem>Undo</MenuItem>
175
+ <MenuItem>Redo</MenuItem>
176
+ </MenuContent>
177
+ </Menu>
178
+ </Menubar>
179
+ </template>
180
+ ```
181
+
182
+ ## Submenu
183
+
184
+ A submenu still uses Menu’s Sub, SubTrigger, and SubContent. The arrow toward it enters that level. On an ordinary item, the same arrow can move to the next top-level menu instead.
185
+
186
+ ```vue title="submenu.vue"
187
+ <script setup lang="ts">
188
+ import { ChevronRightIcon } from "@lucide/vue"
189
+ import {
190
+ Menu,
191
+ MenuContent,
192
+ MenuItem,
193
+ MenuSub,
194
+ MenuSubContent,
195
+ MenuSubTrigger,
196
+ MenuTrigger,
197
+ } from "@ui-sdk/vue/menu"
198
+ import { Menubar } from "@ui-sdk/vue/menubar"
199
+ </script>
200
+
201
+ <template>
202
+ <Menubar>
203
+ <Menu>
204
+ <MenuTrigger>File</MenuTrigger>
205
+ <MenuContent>
206
+ <MenuItem>New File</MenuItem>
207
+ <MenuSub>
208
+ <MenuSubTrigger>
209
+ Share
210
+ <ChevronRightIcon aria-hidden="true" />
211
+ </MenuSubTrigger>
212
+ <MenuSubContent>
213
+ <MenuItem>Email link</MenuItem>
214
+ <MenuItem>Messages</MenuItem>
215
+ </MenuSubContent>
216
+ </MenuSub>
217
+ </MenuContent>
218
+ </Menu>
219
+ <Menu>
220
+ <MenuTrigger>Edit</MenuTrigger>
221
+ <MenuContent>
222
+ <MenuItem>Undo</MenuItem>
223
+ <MenuSub>
224
+ <MenuSubTrigger>
225
+ Find
226
+ <ChevronRightIcon aria-hidden="true" />
227
+ </MenuSubTrigger>
228
+ <MenuSubContent>
229
+ <MenuItem>Find…</MenuItem>
230
+ <MenuItem>Find Next</MenuItem>
231
+ </MenuSubContent>
232
+ </MenuSub>
233
+ </MenuContent>
234
+ </Menu>
235
+ </Menubar>
236
+ </template>
237
+ ```
238
+
239
+ Open File and enter Share with the arrow key. Go back to File, then move to Edit without leaving the menubar.
240
+
241
+ ## Vertical
242
+
243
+ Set `orientation="vertical"` to move between triggers with Up and Down. The arrow toward the popup opens it; the arrow back closes it and returns to the trigger.
244
+
245
+ ```vue title="vertical.vue"
246
+ <script setup lang="ts">
247
+ import { Menu, MenuContent, MenuItem, MenuTrigger } from "@ui-sdk/vue/menu"
248
+ import { Menubar } from "@ui-sdk/vue/menubar"
249
+ </script>
250
+
251
+ <template>
252
+ <Menubar orientation="vertical">
253
+ <Menu v-for="label in ['Inbox', 'Drafts', 'Archive']" :key="label">
254
+ <MenuTrigger>{{ label }}</MenuTrigger>
255
+ <MenuContent>
256
+ <MenuItem>Open {{ label }}</MenuItem>
257
+ <MenuItem>Mark all as read</MenuItem>
258
+ </MenuContent>
259
+ </Menu>
260
+ </Menubar>
261
+ </template>
262
+ ```
263
+
264
+ Use Up and Down to choose Inbox, Drafts, or Archive. Right opens its menu in left-to-right text; Left returns to its trigger.
265
+
266
+ ## Menus as Data
267
+
268
+ Each Menu can take `items` and register its shortcuts while closed. The [Menu data example](./menu.md#menus-as-data) explains the item shapes and callbacks.
269
+
270
+ ```vue
271
+ <script setup lang="ts">
272
+ const file: MenuData = [
273
+ { value: "new", label: "New File", shortcut: "mod+alt+n" },
274
+ { value: "open", label: "Open…" },
275
+ { type: "separator" },
276
+ {
277
+ type: "submenu",
278
+ label: "Share",
279
+ items: [{ value: "email", label: "Email link" }],
280
+ },
281
+ ]
282
+ </script>
283
+
284
+ <template>
285
+ <Menubar>
286
+ <Menu :items="file" @action="(value) => run(value)">
287
+ <MenuTrigger>File</MenuTrigger>
288
+ <MenuContent />
289
+ </Menu>
290
+ </Menubar>
291
+ </template>
292
+ ```
293
+
294
+ ## Disabled
295
+
296
+ A disabled trigger stays focusable with `aria-disabled`, so people can discover it, but cannot open its menu. Set `disabled` on the bar to disable all its triggers while preserving the tab stop.
297
+
298
+ ```vue
299
+ <Menubar>
300
+ <Menu>
301
+ <MenuTrigger disabled>Share</MenuTrigger>
302
+ <MenuContent />
303
+ </Menu>
304
+ </Menubar>
305
+
306
+ <Menubar disabled />
307
+ ```
308
+
309
+ ## Modal
310
+
311
+ The bar supplies `modal` to menus that do not set their own value. The default, `"pointer"`, consumes an outside press while closing. With `true`, the page also becomes inert and stops scrolling, but the menubar stays usable so you can switch menus.
312
+
313
+ ```vue
314
+ <Menubar :modal="true" />
315
+ ```
316
+
317
+ ## Loop
318
+
319
+ Arrow keys wrap between triggers and open menus by default. Set `loop` false to stop at the ends.
320
+
321
+ ```vue
322
+ <Menubar :loop="false" />
323
+ ```
324
+
325
+ ## Controller
326
+
327
+ Create a `createMenubarController()` and pass it to the bar. `focus()` moves focus to it; `close()` closes its active menu. Each menu still owns its own open state and controller. Connect a shortcut like Alt+M to `focus()`, like an application command that moves focus into its menus.
328
+
329
+ ```vue
330
+ <script setup lang="ts">
331
+ const menubar = createMenubarController()
332
+ useShortcut("alt+m", () => menubar.focus())
333
+ </script>
334
+
335
+ <template>
336
+ <Menubar :controller="menubar" />
337
+ <button @click="menubar.focus()">Focus Menubar</button>
338
+ </template>
339
+ ```
340
+
341
+ ## Shared Menu Features
342
+
343
+ [Checkboxes](./menu.md#checkboxes), [radio groups](./menu.md#radio-group), [icons](./menu.md#icons), [shortcuts](./menu.md#shortcuts), and [links](./menu.md#links-and-custom-rendering) work as they do in Menu. The first example combines settings and actions in one bar. Menus inside a menubar always use the popover presentation.
344
+
345
+ ## Styling
346
+
347
+ The bar gets `data-open` while any menu is open; a trigger gets it only for its own menu. Use `data-orientation` for row or column layout. Style the popups and their items through the same [Menu attributes and CSS variables](./menu.md#styling).
348
+
349
+ Each part has a `data-slot`, such as `menubar`, and its state attributes are listed under [Data Attributes](#data-attributes).
350
+
351
+ ## Data Attributes
352
+
353
+ ### Menubar
354
+ `[data-slot="menubar"]`
355
+
356
+ - `data-orientation` (`horizontal`, `vertical`): Which arrow keys move between menus.
357
+ - `data-disabled`: Present when the whole menubar is disabled.
358
+ - `data-open`: Present while one of its menus is open.
359
+
360
+ ## API Reference
361
+
362
+ Props are the same as below.
363
+
364
+ ### Menubar
365
+
366
+ - `orientation?` (`MenubarOrientation`): Which arrow keys move between menus: left and right, or up and down. A vertical menubar opens its menus to the side.
367
+ - `loop?` (`boolean`): Whether arrow keys wrap from the last menu to the first, between triggers and between open menus.
368
+ - `disabled?` (`boolean`): Stops every menu from opening. Triggers stay focusable with `aria-disabled`, so the menubar keeps its tab stop and stays discoverable.
369
+ - `modal?` (`"pointer" | boolean`): The `modal` setting of every menu in the menubar that doesn't set its own. `"pointer"`: an outside press only closes the open menu. `true`: also locks scroll, traps focus and makes the rest of the page inert, except the menubar. `false`: outside presses reach what they hit.
370
+ - `controller?` (`{ focus: () => void; isOpen: () => boolean; close: (options?: ChangeOptions<MenuOpenChangeReason>) => boolean; }`): Opens, closes and focuses the menubar from anywhere. Create one with `createMenubarController()`.
371
+ - `debug?` (`boolean`): Logs every state change with its reason to the console, in development builds.
372
+
373
+ Menus, items and their icons take the props on the Menu page, like [`MenuItemIcon`](./menu.md#menuitemicon).
374
+
375
+ ### State
376
+
377
+ - `orientation` (`MenubarOrientation`): Which arrow keys move between menus, from the `orientation` option. A vertical menubar opens its menus to the side.
378
+ - `disabled` (`boolean`): Whether the whole menubar is disabled.
379
+ - `open` (`boolean`): Whether one of its menus is open.
380
+ - `modal` (`boolean | "pointer"`): The modal setting its menus inherit.
381
+
382
+ ### Reasons
383
+
384
+ A menu that another menu in the menubar takes over closes with `submenu-switch`, one opened by pointing at its trigger opens with `trigger-hover`, and one opened with an arrow key opens with `trigger-press`. See [Menu](./menu.md#reasons) for every reason.
385
+
386
+ ### Controller
387
+
388
+ - `focus()` (`() => void`): Moves focus to the trigger that holds the menubar's tab stop: the one used last, or the first.
389
+ - `isOpen()` (`() => boolean`): Whether one of its menus is open.
390
+ - `close(options?)` (`(options?: ChangeOptions<MenuOpenChangeReason> | undefined) => boolean`): Closes the open menu, if any, and its submenus. Returns false when the close was canceled or it was already closed.
391
+
392
+ ## Accessibility
393
+
394
+ The menubar follows the [WAI-ARIA menubar pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/).
395
+
396
+ ### Keyboard
397
+
398
+ Tab first lands on the first trigger, then remembers the last one used. While a menu is open, moving the pointer onto another enabled trigger opens its menu, unless the pointer is only passing over it on the way into the open menu. Pressing that trigger keeps it open. Moving to a disabled trigger closes the current menu without opening another.
399
+
400
+ | Key | On a Trigger | In an Open Menu |
401
+ | --------------- | ------------------------- | ------------------------------------------------ |
402
+ | Left / Right | Previous or next trigger. | Previous or next menu, or enter/leave a submenu. |
403
+ | Down | Open at the first item. | Next item. |
404
+ | Up | Open at the last item. | Previous item. |
405
+ | Enter / Space | Open at the first item. | Choose the focused item. |
406
+ | Home / End | First or last trigger. | First or last item. |
407
+ | A letter | Find a trigger by name. | Find an item by name. |
408
+ | Escape | — | Close and return to the trigger. |
409
+ | Tab / Shift+Tab | Leave the bar. | Close and leave the bar. |
410
+
411
+ These directions describe a horizontal bar in left-to-right text. Right-to-left text reverses the horizontal keys and submenu side; vertical bars use Up and Down between triggers.
412
+
413
+ ### Tested Behavior
414
+
415
+ Every line below is an automated test.
416
+
417
+ - The menubar is named, and its triggers are menu items that open menus.
418
+ - The menubar is one tab stop, on its first trigger.
419
+ - Left and Right move between triggers, and Home goes to the first.
420
+ - Tab comes back to the trigger used last.
421
+ - ArrowDown opens a menu and focuses its first item.
422
+ - Enter opens a menu and focuses its first item.
423
+ - Space opens a menu and focuses its first item.
424
+ - Escape closes the menu and focuses its trigger.
425
+ - Tab in an open menu closes it and moves past the menubar.
426
+ - A press opens a menu, and a press on its trigger closes it.
427
+ - While a menu is open, pointing at another trigger opens its menu instead.
428
+ - Crossing another trigger on the way to the open menu keeps the menu.
429
+ - Resting on another trigger on the way to the open menu switches to it.
430
+ - While a menu is open, pointing at a disabled trigger closes it and opens nothing.
431
+ - After pointing at a disabled trigger, pointing at another trigger opens its menu.
432
+ - Pointing at a trigger while every menu is closed opens nothing.
433
+ - A press outside closes the open menu.
434
+ - Choosing an item runs it, closes the menu and focuses its trigger.
435
+ - Checkbox and radio items work in a menubar's menus.
436
+ - A disabled item in a menubar's menu is focusable and does nothing.
437
+ - With loop off, arrows stop at the ends.
438
+
439
+ **Vertical**
440
+
441
+ - Up and Down move between triggers, and Right opens a menu to the side.
442
+
443
+ Runs in React, Vue and web components.