vlite3 1.5.11 → 1.5.13

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 (132) hide show
  1. package/README.md +20 -8
  2. package/components/Accordion/AccordionContent.vue.js +2 -2
  3. package/components/CategoryManager/CategoryManager2.vue.js +1 -1
  4. package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
  5. package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
  6. package/components/Dropdown/DropdownMenu.vue.js +1 -1
  7. package/components/Form/{AccordionView.vue.js → AccordionView2.vue.js} +2 -2
  8. package/components/Form/Form.vue.js +2 -2
  9. package/components/Form/index2.vue.js +1 -1
  10. package/components/NavbarCommandPalette.vue.js +1 -1
  11. package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +7 -7
  12. package/components/PanZoomViewport/PanZoomViewport.vue.js +1 -1
  13. package/components/Screen/ScreenFilter.vue.js +1 -1
  14. package/components/Splitter/Splitter.vue.d.ts +7 -0
  15. package/components/Splitter/Splitter.vue.js +33 -29
  16. package/components/Tabes/Tabes.vue.js +2 -2
  17. package/docs/README.md +17 -0
  18. package/docs/all-components.md +89 -0
  19. package/docs/component-index.md +313 -0
  20. package/docs/components/accordion.md +52 -0
  21. package/docs/components/alert.md +34 -0
  22. package/docs/components/app-shell.md +371 -0
  23. package/docs/components/async-select.md +264 -0
  24. package/docs/components/attachments-list.md +231 -0
  25. package/docs/components/avatar-group.md +74 -0
  26. package/docs/components/avatar-uploader.md +61 -0
  27. package/docs/components/avatar.md +28 -0
  28. package/docs/components/badge.md +81 -0
  29. package/docs/components/barcode.md +42 -0
  30. package/docs/components/beacon.md +29 -0
  31. package/docs/components/breadcrumb.md +317 -0
  32. package/docs/components/button-group.md +35 -0
  33. package/docs/components/button.md +86 -0
  34. package/docs/components/calendar.md +95 -0
  35. package/docs/components/carousel.md +122 -0
  36. package/docs/components/cart.md +533 -0
  37. package/docs/components/category-manager.md +269 -0
  38. package/docs/components/category-menu.md +251 -0
  39. package/docs/components/charts.md +1456 -0
  40. package/docs/components/chat.md +330 -0
  41. package/docs/components/checkbox.md +31 -0
  42. package/docs/components/chip.md +137 -0
  43. package/docs/components/choice-box.md +40 -0
  44. package/docs/components/clipboard.md +105 -0
  45. package/docs/components/clock.md +70 -0
  46. package/docs/components/color-picker.md +82 -0
  47. package/docs/components/command-palette.md +214 -0
  48. package/docs/components/comment-thread.md +171 -0
  49. package/docs/components/confirmation-modal.md +50 -0
  50. package/docs/components/custom-fields-display.md +94 -0
  51. package/docs/components/custom-fields.md +97 -0
  52. package/docs/components/data-list.md +93 -0
  53. package/docs/components/data-table.md +922 -0
  54. package/docs/components/date-picker.md +58 -0
  55. package/docs/components/date-range-picker.md +24 -0
  56. package/docs/components/date-time.md +104 -0
  57. package/docs/components/dropdown.md +740 -0
  58. package/docs/components/empty.md +100 -0
  59. package/docs/components/export-data.md +320 -0
  60. package/docs/components/file-picker.md +83 -0
  61. package/docs/components/file-preview.md +42 -0
  62. package/docs/components/file-tree.md +144 -0
  63. package/docs/components/footer.md +251 -0
  64. package/docs/components/forms.md +776 -0
  65. package/docs/components/gantt-chart.md +767 -0
  66. package/docs/components/google-login.md +67 -0
  67. package/docs/components/google-map.md +128 -0
  68. package/docs/components/heatmap.md +80 -0
  69. package/docs/components/icon-picker.md +58 -0
  70. package/docs/components/icon.md +176 -0
  71. package/docs/components/image-comparison.md +51 -0
  72. package/docs/components/image-magnifier.md +26 -0
  73. package/docs/components/import-data.md +521 -0
  74. package/docs/components/input.md +58 -0
  75. package/docs/components/invoice.md +339 -0
  76. package/docs/components/kanban.md +302 -0
  77. package/docs/components/label.md +25 -0
  78. package/docs/components/list.md +419 -0
  79. package/docs/components/masonry.md +55 -0
  80. package/docs/components/modal.md +133 -0
  81. package/docs/components/multi-select.md +54 -0
  82. package/docs/components/navbar.md +403 -0
  83. package/docs/components/number-input.md +41 -0
  84. package/docs/components/otp-input.md +68 -0
  85. package/docs/components/pagination.md +83 -0
  86. package/docs/components/pan-zoom-viewport.md +245 -0
  87. package/docs/components/permission-editor.md +322 -0
  88. package/docs/components/persona.md +56 -0
  89. package/docs/components/price.md +106 -0
  90. package/docs/components/pricing-plan.md +68 -0
  91. package/docs/components/progress-bar.md +53 -0
  92. package/docs/components/qr-code.md +59 -0
  93. package/docs/components/rating.md +59 -0
  94. package/docs/components/rich-text-editor.md +210 -0
  95. package/docs/components/scale-generator.md +101 -0
  96. package/docs/components/screen.md +208 -0
  97. package/docs/components/seo-provider.md +189 -0
  98. package/docs/components/side-panel.md +94 -0
  99. package/docs/components/sidebar-menu.md +422 -0
  100. package/docs/components/skeleton.md +115 -0
  101. package/docs/components/slider.md +48 -0
  102. package/docs/components/spinner.md +27 -0
  103. package/docs/components/splitter.md +97 -0
  104. package/docs/components/stats.md +234 -0
  105. package/docs/components/status-chip.md +232 -0
  106. package/docs/components/switch.md +23 -0
  107. package/docs/components/tabs.md +335 -0
  108. package/docs/components/tag-input.md +55 -0
  109. package/docs/components/textarea.md +31 -0
  110. package/docs/components/theme-provider.md +130 -0
  111. package/docs/components/theme-toggle.md +36 -0
  112. package/docs/components/thumbnail-selector.md +186 -0
  113. package/docs/components/timeline.md +225 -0
  114. package/docs/components/toast-notification.md +89 -0
  115. package/docs/components/tooltip.md +31 -0
  116. package/docs/components/workbook.md +102 -0
  117. package/docs/composables/use-theme.md +59 -0
  118. package/docs/getting-started/setup.md +176 -0
  119. package/docs/guides/draggable.md +211 -0
  120. package/docs/guides/internationalization.md +281 -0
  121. package/docs/guides/performance.md +118 -0
  122. package/docs/guides/testing-forms.md +154 -0
  123. package/docs/guides/testing-overlays.md +131 -0
  124. package/docs/guides/theming.md +124 -0
  125. package/docs/utilities/search.md +580 -0
  126. package/docs/utilities/utilities.md +371 -0
  127. package/docs-manifest.json +339 -0
  128. package/package.json +6 -15
  129. package/scripts/generate-docs-manifest.js +207 -0
  130. package/scripts/sync-docs.js +754 -0
  131. package/style.css +1 -1
  132. /package/components/Dropdown/{DropdownMenu2.vue.js → DropdownMenu3.vue.js} +0 -0
@@ -0,0 +1,740 @@
1
+ # Dropdown
2
+
3
+ **Import:** `import { Dropdown } from 'vlite3'`
4
+
5
+ A flexible, feature-rich dropdown component supporting single selection, nested menus, remote search, pagination, boolean toggles, grouped layouts, double confirmation, RTL direction, and more.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ | Prop | Type | Default | Description |
12
+ | -------------------- | -------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------- |
13
+ | `selected` | `any` | — | Selected value (alternative to v-model) |
14
+ | `modelValue` | `any` | — | Binding (`v-model`) |
15
+ | `className` | `string` | `''` | Custom class for dropdown menu |
16
+ | `emptyMessage` | `string` | `'No options found'` | Message when no options match |
17
+ | `position` | `TooltTipPlacement` | — | Dropdown placement direction |
18
+ | `closeOnSelect` | `boolean` | `true` | Close dropdown after selection |
19
+ | `toggleSelection` | `boolean` | `true` | Allow deselecting currently active option |
20
+ | `options` | `IDropdownOptions \| string[] \| number[]` | `[]` | Array of options (supports plain strings/numbers) |
21
+ | `canCloseOutside` | `boolean` | `true` | Close when clicking outside |
22
+ | `caret` | `boolean` | `false` | Show caret arrow indicator |
23
+ | `offset` | `[number, number]` | `[0, 8]` | X/Y offset for dropdown |
24
+ | `isOpen` | `boolean` | — | Manual control of open state |
25
+ | `teleport` | `boolean` | `true` | Teleport menu to body |
26
+ | `selectedIndex` | `number \| null` | `null` | Index of highlighted item |
27
+ | `maxHeight` | `string` | `'300px'` | Max height of menu |
28
+ | `width` | `string` | — | Custom width |
29
+ | `ignoreClickOutside` | `string[]` | — | Array of element IDs to ignore |
30
+ | `menuId` | `string` | — | HTML ID for the menu container |
31
+ | `nestedPosition` | `TooltTipPlacement` | — | Default position for all nested child dropdowns |
32
+ | `nestedOffset` | `[number, number]` | — | Default offset for all nested child dropdowns |
33
+ | `showSelectedLabel` | `boolean` | `true` | Show the selected label in trigger |
34
+ | `selectable` | `boolean` | `true` | Enable item selection styles |
35
+ | `doubleConfirmation` | `boolean` | `false` | Require confirmation for selection |
36
+ | `layout` | `'default' \| 'grouped'` | `'default'` | Layout mode for options |
37
+ | `columns` | `number \| string` | `3` | Number of columns in grouped layout (also accepts CSS grid string e.g. `'200px 1fr'`) |
38
+ | `loading` | `boolean` | `false` | Show loading spinner state |
39
+ | `hasMore` | `boolean` | `false` | Show "Load More" indicator for pagination |
40
+ | `searchable` | `boolean` | `true` | Enable search input (auto-shown for >9 options) |
41
+ | `remote` | `boolean` | `false` | Enable remote data loading mode |
42
+ | `debounceTime` | `number` | `300` | Debounce delay (ms) for remote search emit |
43
+ | `fetchSelected` | `(ids: any[]) => Promise<IDropdownOption[]>` | — | Async function to hydrate selected labels in remote/paginated mode |
44
+ | `triggerProps` | `ButtonProps` | — | Additional props for default trigger button |
45
+ | `direction` | `'ltr' \| 'rtl' \| 'auto'` | `'auto'` | Text/layout direction. `auto` follows nearest ancestor `dir`, then `html[dir]` |
46
+
47
+ ---
48
+
49
+ ## Types
50
+
51
+ ```ts
52
+ export type IDropdownOption = {
53
+ label: string
54
+ labelI18n?: string
55
+ value?: any
56
+ key?: string
57
+ subtitle?: string
58
+ subtitleI18n?: string
59
+ description?: string
60
+ descriptionI18n?: string
61
+ icon?: string
62
+ emoji?: string
63
+ disabled?: boolean
64
+ children?: IDropdownOption[]
65
+
66
+ // --- Per-item styling ---
67
+ class?: string // Applied to the option row element
68
+ triggerClass?: string // Applied to the nested trigger wrapper (only for items with children)
69
+
70
+ // --- Per-item nested dropdown control ---
71
+ position?: TooltTipPlacement // Overrides nestedPosition for this specific item
72
+ offset?: [number, number] // Overrides nestedOffset for this specific item
73
+ showChevron?: boolean // Show/hide the chevron icon for this item (default: true)
74
+
75
+ confirmation?:
76
+ | boolean
77
+ | {
78
+ title?: string
79
+ description?: string
80
+ confirmText?: string
81
+ cancelText?: string
82
+ variant?: string
83
+ }
84
+ data?: any
85
+
86
+ // --- Individual Select Hook ---
87
+ onSelect?: (payload: {
88
+ value: any
89
+ option: IDropdownOption
90
+ data: IDropdownOption[]
91
+ values?: any
92
+ }) => void
93
+ }
94
+
95
+ export type IDropdownOptions = IDropdownOption[]
96
+ ```
97
+
98
+ ### Per-item Option Fields
99
+
100
+ | Field | Type | Default | Description |
101
+ | -------------- | ------------------- | ------- | -------------------------------------------------------------------------------------------------------- |
102
+ | `class` | `string` | — | CSS class applied to the option row (both leaf items and nested trigger rows) |
103
+ | `triggerClass` | `string` | — | CSS class applied only to the nested trigger wrapper div (takes priority over `class` for nested items) |
104
+ | `position` | `TooltTipPlacement` | — | Overrides the global `nestedPosition` prop for this specific child dropdown |
105
+ | `offset` | `[number, number]` | — | Overrides the global `nestedOffset` prop for this specific child dropdown |
106
+ | `showChevron` | `boolean` | `true` | Set to `false` to hide the chevron arrow on a specific nested item |
107
+ | `onSelect` | `Function` | — | Callback triggered when this specific option is selected. Receives the fully merged root `values` state. |
108
+
109
+ ### Special `data` fields
110
+
111
+ | Field | Type | Description |
112
+ | ---------------- | --------- | -------------------------------------------------------------- |
113
+ | `data.isBoolean` | `boolean` | Renders option as a toggle Switch instead of a selectable item |
114
+ | `data.avatar` | `string` | Avatar URL (used in custom `#item` slot patterns) |
115
+
116
+ ### Separator
117
+
118
+ Use `label: '---'` to render a horizontal divider line between options:
119
+
120
+ ```ts
121
+ {
122
+ label: '---'
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Events
129
+
130
+ | Event | Payload | Description |
131
+ | -------------------- | ---------------------------- | ------------------------------------------------------------ |
132
+ | `@onSelect` | `{ value: any; data?: any }` | Emitted when an option is selected |
133
+ | `@update:modelValue` | `any` | Emitted to update v-model |
134
+ | `@onOpen` | — | Emitted when dropdown opens |
135
+ | `@onClose` | — | Emitted when dropdown closes |
136
+ | `@update:isOpen` | `boolean` | Emitted on open/close state change |
137
+ | `@load-more` | — | Emitted when scrolled to bottom (requires `hasMore: true`) |
138
+ | `@search` | `string` | Emitted when search query changes (debounced in remote mode) |
139
+
140
+ ---
141
+
142
+ ## Slots
143
+
144
+ | Slot | Description | Slot Props |
145
+ | --------- | -------------------------------- | --------------------------------------------------------------- |
146
+ | `trigger` | Custom trigger element | `{ isOpen: boolean, selectedLabel: string }` |
147
+ | `item` | Custom option rendering | `{ option: IDropdownOption, index: number, selected: boolean }` |
148
+ | `header` | Sticky content at top of menu | — |
149
+ | `footer` | Sticky content at bottom of menu | — |
150
+ | `menu` | Full menu replacement | — |
151
+
152
+ ---
153
+
154
+ ## Exports
155
+
156
+ ```ts
157
+ import {
158
+ Dropdown,
159
+ DropdownMenu,
160
+ DropdownTrigger,
161
+ DropdownItem,
162
+ useDropdownSelection,
163
+ useDropdownIds,
164
+ } from 'vlite3'
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Usage
170
+
171
+ ### Basic Usage
172
+
173
+ ```vue
174
+ <script setup lang="ts">
175
+ import { ref } from 'vue'
176
+ import { Dropdown } from 'vlite3'
177
+ import Button from 'vlite3/Button'
178
+
179
+ const val = ref('1')
180
+ </script>
181
+
182
+ <template>
183
+ <Dropdown
184
+ closeOnSelect
185
+ :options="[
186
+ { value: '1', label: 'Dashboard', icon: 'lucide:layout-dashboard' },
187
+ { value: '2', label: 'Settings', icon: 'lucide:settings' },
188
+ { value: '3', label: 'Profile', emoji: '🚀' },
189
+ { value: '4', label: 'Logout', icon: 'lucide:log-out', disabled: true },
190
+ ]"
191
+ :selected="val"
192
+ @on-select="(opt) => (val = opt.value)">
193
+ <template #trigger>
194
+ <Button variant="outline" icon-right="lucide:chevron-down">Menu</Button>
195
+ </template>
196
+ </Dropdown>
197
+ </template>
198
+ ```
199
+
200
+ ---
201
+
202
+ ### Per-item onSelect Callback
203
+
204
+ You can attach an `onSelect` callback directly to individual options. This is especially useful for nested configurations where you need the complete, fully-merged state (`values`) of the root dropdown after a deeply nested item is selected.
205
+
206
+ ```vue
207
+ <script setup lang="ts">
208
+ import { ref } from 'vue'
209
+ import { Dropdown } from 'vlite3'
210
+
211
+ const config = ref({})
212
+ </script>
213
+
214
+ <template>
215
+ <Dropdown
216
+ v-model="config"
217
+ :options="[
218
+ {
219
+ label: 'Advanced Settings',
220
+ key: 'advanced',
221
+ // The callback triggers even if a child nested deep inside is clicked
222
+ onSelect: (payload) => {
223
+ console.log('Advanced Settings interacted with!', payload.values)
224
+ },
225
+ children: [
226
+ {
227
+ label: 'Delete Branch',
228
+ value: 'delete-branch',
229
+ class: 'text-danger',
230
+ // Specifically listen to this leaf node
231
+ onSelect: ({ value, option, values }) => {
232
+ console.log('Selected value:', value) // 'delete-branch'
233
+ console.log('Full config state:', values) // e.g. { advanced: 'delete-branch' }
234
+ },
235
+ },
236
+ { label: 'Force Push', value: 'force-push' },
237
+ ],
238
+ },
239
+ ]">
240
+ <template #trigger>
241
+ <Button variant="outline">Advanced</Button>
242
+ </template>
243
+ </Dropdown>
244
+ </template>
245
+ ```
246
+
247
+ ---
248
+
249
+ ### Per-item Class Styling
250
+
251
+ Use `class` to style any option row. For nested items (with `children`), use `triggerClass` to target the trigger wrapper specifically — it takes priority over `class` on nested rows.
252
+
253
+ ```vue
254
+ :options="[ { label: 'Delete', value: 'delete', class: 'text-destructive hover:bg-destructive/10',
255
+ }, { label: 'More Options', class: 'font-semibold', triggerClass: 'bg-muted', children: [ { label:
256
+ 'Export', value: 'export' }, { label: 'Archive', value: 'archive' }, ], }, ]"
257
+ ```
258
+
259
+ ---
260
+
261
+ ### Per-item Nested Dropdown Control
262
+
263
+ Each option with `children` can independently override the global `nestedPosition`, `nestedOffset`, and `showChevron` settings.
264
+
265
+ ```vue
266
+ :options="[ { label: 'Appearance', icon: 'lucide:palette', position: 'bottom-start', // override:
267
+ open below instead of to the right offset: [0, 4], // override: custom offset for this item
268
+ showChevron: false, // hide the chevron arrow for this item children: [ { label: 'Light', value:
269
+ 'light' }, { label: 'Dark', value: 'dark' }, ], }, { label: 'Language', // uses global
270
+ nestedPosition / nestedOffset / showChevron defaults children: [ { label: 'English', value: 'en' },
271
+ { label: 'French', value: 'fr' }, ], }, ]"
272
+ ```
273
+
274
+ ---
275
+
276
+ ### v-model Binding
277
+
278
+ ```vue
279
+ <Dropdown v-model="selectedUser" :options="users" searchable>
280
+ <template #trigger="{ selectedLabel }">
281
+ <Button variant="outline">
282
+ {{ selectedLabel || 'Select User' }}
283
+ </Button>
284
+ </template>
285
+ </Dropdown>
286
+ ```
287
+
288
+ ---
289
+
290
+ ### Custom Item Slot
291
+
292
+ Render each option with a custom template using the `#item` slot.
293
+
294
+ ```vue
295
+ <Dropdown v-model="selectedUser" :options="users">
296
+ <template #trigger="{ selectedLabel }">
297
+ <Button variant="outline">
298
+ {{ selectedLabel || 'Select User' }}
299
+ </Button>
300
+ </template>
301
+
302
+ <template #item="{ option }">
303
+ <div class="flex items-center gap-2 p-2 hover:bg-muted rounded-md cursor-pointer">
304
+ <Avatar :src="option.data?.avatar" size="xs" />
305
+ <div class="flex flex-col">
306
+ <span class="font-medium">{{ option.label }}</span>
307
+ <span class="text-xs text-muted-foreground">{{ option.description }}</span>
308
+ </div>
309
+ </div>
310
+ </template>
311
+ </Dropdown>
312
+ ```
313
+
314
+ ---
315
+
316
+ ### Rich Options (Icon, Emoji, Subtitle, Description)
317
+
318
+ ```vue
319
+ <Dropdown
320
+ v-model="selected"
321
+ :options="[
322
+ {
323
+ value: 'vue',
324
+ label: 'Vue.js',
325
+ subtitle: 'v3.x',
326
+ description: 'Progressive JavaScript Framework',
327
+ icon: 'logos:vue',
328
+ },
329
+ {
330
+ value: 'react',
331
+ label: 'React',
332
+ subtitle: 'v18',
333
+ description: 'A JS library for building UIs',
334
+ emoji: '⚛️',
335
+ },
336
+ ]">
337
+ <template #trigger="{ selectedLabel }">
338
+ <Button variant="outline">{{ selectedLabel || 'Choose Framework' }}</Button>
339
+ </template>
340
+ </Dropdown>
341
+ ```
342
+
343
+ ---
344
+
345
+ ### Scrollable (Many Options)
346
+
347
+ The search input automatically appears when there are more than 9 options.
348
+
349
+ ```vue
350
+ <Dropdown
351
+ :options="Array.from({ length: 20 }, (_, i) => ({ value: `${i}`, label: `Option ${i + 1}` }))"
352
+ v-model="selected">
353
+ <template #trigger>
354
+ <Button variant="outline" icon-right="lucide:chevron-down">Long List</Button>
355
+ </template>
356
+ </Dropdown>
357
+ ```
358
+
359
+ ---
360
+
361
+ ### Button Variants
362
+
363
+ The `#trigger` slot accepts any Button variant.
364
+
365
+ ```vue
366
+ <Dropdown :options="options" v-model="val">
367
+ <template #trigger>
368
+ <Button variant="outline" size="sm" icon-right="lucide:chevron-down">Outline</Button>
369
+ </template>
370
+ </Dropdown>
371
+
372
+ <Dropdown :options="options" v-model="val">
373
+ <template #trigger>
374
+ <Button variant="primary" icon-right="lucide:chevron-down">Primary</Button>
375
+ </template>
376
+ </Dropdown>
377
+
378
+ <Dropdown :options="options" v-model="val">
379
+ <template #trigger>
380
+ <Button variant="ghost" icon-right="lucide:chevron-down">Ghost</Button>
381
+ </template>
382
+ </Dropdown>
383
+ ```
384
+
385
+ ---
386
+
387
+ ### Nested (Children)
388
+
389
+ Options with a `children` array render as a sub-dropdown triggered on hover/click.
390
+
391
+ ```vue
392
+ <script setup lang="ts">
393
+ import { ref } from 'vue'
394
+ import { Dropdown } from 'vlite3'
395
+
396
+ const selected = ref(null)
397
+ </script>
398
+
399
+ <template>
400
+ <Dropdown
401
+ v-model="selected"
402
+ :options="[
403
+ {
404
+ label: 'Appearance',
405
+ icon: 'lucide:palette',
406
+ children: [
407
+ { label: 'Light', value: 'light' },
408
+ { label: 'Dark', value: 'dark' },
409
+ { label: 'System', value: 'system' },
410
+ ],
411
+ },
412
+ { label: 'Settings', value: 'settings', icon: 'lucide:settings' },
413
+ ]">
414
+ <template #trigger="{ selectedLabel }">
415
+ <Button variant="outline">{{ selectedLabel || 'Options' }}</Button>
416
+ </template>
417
+ </Dropdown>
418
+ </template>
419
+ ```
420
+
421
+ ---
422
+
423
+ ### Recursive / Keyed Object Selection
424
+
425
+ Use `key` on options to map selections into a structured object. Nested dropdowns merge into the parent `v-model` object using deep merge logic.
426
+
427
+ ```vue
428
+ <script setup lang="ts">
429
+ import { ref } from 'vue'
430
+ import { Dropdown } from 'vlite3'
431
+
432
+ // v-model will be shaped as: { theme: 'dark', language: 'en' }
433
+ const config = ref({})
434
+ </script>
435
+
436
+ <template>
437
+ <Dropdown
438
+ v-model="config"
439
+ :options="[
440
+ {
441
+ label: 'Theme',
442
+ key: 'theme',
443
+ children: [
444
+ { label: 'Light', value: 'light' },
445
+ { label: 'Dark', value: 'dark' },
446
+ ],
447
+ },
448
+ {
449
+ label: 'Language',
450
+ key: 'language',
451
+ children: [
452
+ { label: 'English', value: 'en' },
453
+ { label: 'French', value: 'fr' },
454
+ ],
455
+ },
456
+ ]">
457
+ <template #trigger>
458
+ <Button variant="outline">Configure</Button>
459
+ </template>
460
+ </Dropdown>
461
+ </template>
462
+ ```
463
+
464
+ ---
465
+
466
+ ### Boolean Toggle Items
467
+
468
+ Set `data.isBoolean = true` on an option to render a `Switch` toggle instead of a selectable item.
469
+ Requires a `key` field. The `v-model` object will have that key set to `true`/`false`.
470
+
471
+ ```vue
472
+ <script setup lang="ts">
473
+ import { ref } from 'vue'
474
+ import { Dropdown } from 'vlite3'
475
+
476
+ const settings = ref({ notifications: true, darkMode: false })
477
+ </script>
478
+
479
+ <template>
480
+ <Dropdown
481
+ v-model="settings"
482
+ :options="[
483
+ { label: 'Notifications', key: 'notifications', value: true, data: { isBoolean: true } },
484
+ { label: 'Dark Mode', key: 'darkMode', value: false, data: { isBoolean: true } },
485
+ ]">
486
+ <template #trigger>
487
+ <Button variant="outline">Settings</Button>
488
+ </template>
489
+ </Dropdown>
490
+ </template>
491
+ ```
492
+
493
+ ---
494
+
495
+ ### Separators
496
+
497
+ Insert a horizontal divider by using `label: '---'`.
498
+
499
+ ```vue
500
+ :options="[ { value: 'profile', label: 'Profile' }, { value: 'settings', label: 'Settings' }, {
501
+ label: '---' }, { value: 'logout', label: 'Logout' }, ]"
502
+ ```
503
+
504
+ ---
505
+
506
+ ### Double Confirmation
507
+
508
+ Wrap any selection in a confirmation modal using `doubleConfirmation` (global) or per-option `confirmation`.
509
+
510
+ ```vue
511
+ <Dropdown v-model="val" :options="options" :double-confirmation="true">
512
+ <template #trigger>
513
+ <Button variant="outline">Select with confirm</Button>
514
+ </template>
515
+ </Dropdown>
516
+
517
+ :options="[ { value: 'delete', label: 'Delete Account', confirmation: { title: 'Delete Account?',
518
+ description: 'This action cannot be undone.', confirmText: 'Delete', cancelText: 'Cancel', variant:
519
+ 'danger', }, }, { value: 'edit', label: 'Edit Profile' }, ]"
520
+ ```
521
+
522
+ ---
523
+
524
+ ### RTL Direction
525
+
526
+ By default `direction="auto"` follows the nearest ancestor `dir` (e.g. an Input addon `dir="ltr"` island), then `html[dir]`. Pass `direction="rtl"` / `"ltr"` to force a side.
527
+
528
+ ```vue
529
+ <Dropdown v-model="val" :options="options" direction="rtl">
530
+ <template #trigger="{ selectedLabel }">
531
+ <Button variant="outline">{{ selectedLabel || 'اختر' }}</Button>
532
+ </template>
533
+ </Dropdown>
534
+ ```
535
+
536
+ ---
537
+
538
+ ### Grouped Layout (Mega Menu)
539
+
540
+ Use `layout="grouped"` with options containing `children` to render a multi-column grid menu.
541
+ Control columns with the `columns` prop (number or CSS grid string).
542
+
543
+ ```vue
544
+ <script setup lang="ts">
545
+ import { ref } from 'vue'
546
+ import { Dropdown } from 'vlite3'
547
+
548
+ const selected = ref(null)
549
+ </script>
550
+
551
+ <template>
552
+ <Dropdown
553
+ v-model="selected"
554
+ layout="grouped"
555
+ :columns="3"
556
+ position="bottom-start"
557
+ :options="[
558
+ {
559
+ label: 'Frontend',
560
+ icon: 'lucide:monitor',
561
+ children: [
562
+ { label: 'Vue', value: 'vue' },
563
+ { label: 'React', value: 'react' },
564
+ { label: 'Svelte', value: 'svelte' },
565
+ ],
566
+ },
567
+ {
568
+ label: 'Backend',
569
+ icon: 'lucide:server',
570
+ children: [
571
+ { label: 'Node.js', value: 'node' },
572
+ { label: 'Django', value: 'django' },
573
+ ],
574
+ },
575
+ {
576
+ label: 'Database',
577
+ icon: 'lucide:database',
578
+ children: [
579
+ { label: 'PostgreSQL', value: 'pg' },
580
+ { label: 'MongoDB', value: 'mongo' },
581
+ ],
582
+ },
583
+ ]">
584
+ <template #trigger>
585
+ <Button variant="outline" icon-right="lucide:chevron-down">Tech Stack</Button>
586
+ </template>
587
+ </Dropdown>
588
+ </template>
589
+ ```
590
+
591
+ ---
592
+
593
+ ### Pagination (Load More)
594
+
595
+ Use `hasMore` and listen to `@load-more` to implement infinite scroll pagination.
596
+
597
+ ```vue
598
+ <script setup lang="ts">
599
+ import { ref } from 'vue'
600
+ import { Dropdown } from 'vlite3'
601
+
602
+ const selected = ref(null)
603
+ const options = ref(Array.from({ length: 15 }, (_, i) => ({ value: i, label: `Item ${i + 1}` })))
604
+ const hasMore = ref(true)
605
+ const loading = ref(false)
606
+ let page = 1
607
+
608
+ const loadMore = async () => {
609
+ if (loading.value) return
610
+ loading.value = true
611
+ await new Promise((r) => setTimeout(r, 800))
612
+ const next = Array.from({ length: 10 }, (_, i) => {
613
+ const n = page * 10 + i + 6
614
+ return { value: n, label: `Item ${n}` }
615
+ })
616
+ options.value.push(...next)
617
+ page++
618
+ if (page >= 4) hasMore.value = false
619
+ loading.value = false
620
+ }
621
+ </script>
622
+
623
+ <template>
624
+ <Dropdown
625
+ v-model="selected"
626
+ :options="options"
627
+ :has-more="hasMore"
628
+ :loading="loading"
629
+ @load-more="loadMore">
630
+ <template #trigger="{ selectedLabel }">
631
+ <Button variant="outline">{{ selectedLabel || 'Load More Demo' }}</Button>
632
+ </template>
633
+ </Dropdown>
634
+ </template>
635
+ ```
636
+
637
+ ---
638
+
639
+ ### Remote Search
640
+
641
+ Set `remote` to disable client-side filtering. The `@search` event is debounced (default 300ms) and fires when the user types. Push new results into `:options` on each search.
642
+
643
+ Use `fetchSelected` to hydrate labels for already-selected values that may not be in the current result set (e.g. after page reload).
644
+
645
+ ```vue
646
+ <script setup lang="ts">
647
+ import { ref } from 'vue'
648
+ import { Dropdown } from 'vlite3'
649
+ import type { IDropdownOption } from 'vlite3'
650
+
651
+ const selected = ref(null)
652
+ const options = ref<IDropdownOption[]>([])
653
+ const loading = ref(false)
654
+
655
+ const onSearch = async (query: string) => {
656
+ loading.value = true
657
+ await new Promise((r) => setTimeout(r, 400))
658
+ options.value = [
659
+ { value: 1, label: `Result for "${query}" #1` },
660
+ { value: 2, label: `Result for "${query}" #2` },
661
+ { value: 3, label: `Result for "${query}" #3` },
662
+ ]
663
+ loading.value = false
664
+ }
665
+
666
+ const fetchSelected = async (ids: any[]): Promise<IDropdownOption[]> => {
667
+ return ids.map((id) => ({ value: id, label: `User #${id}` }))
668
+ }
669
+ </script>
670
+
671
+ <template>
672
+ <Dropdown
673
+ v-model="selected"
674
+ :options="options"
675
+ :loading="loading"
676
+ remote
677
+ searchable
678
+ :fetch-selected="fetchSelected"
679
+ @search="onSearch">
680
+ <template #trigger="{ selectedLabel }">
681
+ <Button variant="outline">{{ selectedLabel || 'Search users...' }}</Button>
682
+ </template>
683
+ </Dropdown>
684
+ </template>
685
+ ```
686
+
687
+ ---
688
+
689
+ ### Sticky Header / Footer Slots
690
+
691
+ Use `#header` and `#footer` slots to render persistent content above and below the scrollable list.
692
+
693
+ ```vue
694
+ <Dropdown v-model="selected" :options="options">
695
+ <template #trigger>
696
+ <Button variant="outline">With Header & Footer</Button>
697
+ </template>
698
+
699
+ <template #header>
700
+ <div class="px-3 py-2 border-b text-xs font-semibold text-muted-foreground uppercase tracking-wide">
701
+ Recent
702
+ </div>
703
+ </template>
704
+
705
+ <template #footer>
706
+ <div class="border-t px-3 py-2">
707
+ <Button variant="ghost" size="sm" class="w-full">+ Add new</Button>
708
+ </div>
709
+ </template>
710
+ </Dropdown>
711
+ ```
712
+
713
+ ---
714
+
715
+ ### Plain String / Number Options
716
+
717
+ The `options` prop also accepts plain string or number arrays — they are normalized automatically.
718
+
719
+ ```vue
720
+ <Dropdown v-model="lang" :options="['English', 'French', 'Arabic']">
721
+ <template #trigger="{ selectedLabel }">
722
+ <Button variant="outline">{{ selectedLabel || 'Language' }}</Button>
723
+ </template>
724
+ </Dropdown>
725
+ ```
726
+
727
+ ---
728
+
729
+ ## Keyboard Navigation
730
+
731
+ | Key | Action |
732
+ | ----------- | ----------------------------- |
733
+ | `ArrowDown` | Move focus to next option |
734
+ | `ArrowUp` | Move focus to previous option |
735
+ | `Enter` | Select focused option |
736
+ | `Escape` | Close dropdown |
737
+
738
+ Mouse movement exits keyboard mode and restores hover highlight.
739
+
740
+ ---