@primevue/mcp 4.5.5 → 5.0.0-rc.2

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 (173) hide show
  1. package/LICENSE.md +45 -21
  2. package/README.md +48 -250
  3. package/data/components.json +47269 -0
  4. package/data/llms/components/accordion.md +629 -0
  5. package/data/llms/components/animateonscroll.md +165 -0
  6. package/data/llms/components/autocomplete.md +995 -0
  7. package/data/llms/components/avatar.md +264 -0
  8. package/data/llms/components/badge.md +200 -0
  9. package/data/llms/components/blockui.md +99 -0
  10. package/data/llms/components/breadcrumb.md +269 -0
  11. package/data/llms/components/button.md +902 -0
  12. package/data/llms/components/card.md +209 -0
  13. package/data/llms/components/carousel.md +506 -0
  14. package/data/llms/components/cascadeselect.md +1207 -0
  15. package/data/llms/components/chart.md +1022 -0
  16. package/data/llms/components/checkbox.md +401 -0
  17. package/data/llms/components/chip.md +206 -0
  18. package/data/llms/components/colorpicker.md +213 -0
  19. package/data/llms/components/commandmenu.md +660 -0
  20. package/data/llms/components/compare.md +407 -0
  21. package/data/llms/components/confirmdialog.md +343 -0
  22. package/data/llms/components/confirmpopup.md +252 -0
  23. package/data/llms/components/contextmenu.md +522 -0
  24. package/data/llms/components/datatable.md +5266 -0
  25. package/data/llms/components/dataview.md +569 -0
  26. package/data/llms/components/datepicker.md +964 -0
  27. package/data/llms/components/deferredcontent.md +96 -0
  28. package/data/llms/components/dialog.md +702 -0
  29. package/data/llms/components/divider.md +152 -0
  30. package/data/llms/components/dock.md +488 -0
  31. package/data/llms/components/drawer.md +469 -0
  32. package/data/llms/components/dynamicdialog.md +214 -0
  33. package/data/llms/components/editor.md +205 -0
  34. package/data/llms/components/fieldset.md +253 -0
  35. package/data/llms/components/fileupload.md +459 -0
  36. package/data/llms/components/floatlabel.md +144 -0
  37. package/data/llms/components/fluid.md +104 -0
  38. package/data/llms/components/focustrap.md +59 -0
  39. package/data/llms/components/forms.md +344 -0
  40. package/data/llms/components/galleria.md +1119 -0
  41. package/data/llms/components/gallery.md +1003 -0
  42. package/data/llms/components/iconfield.md +283 -0
  43. package/data/llms/components/iftalabel.md +96 -0
  44. package/data/llms/components/image.md +179 -0
  45. package/data/llms/components/imagecompare.md +108 -0
  46. package/data/llms/components/inplace.md +183 -0
  47. package/data/llms/components/inputcolor.md +869 -0
  48. package/data/llms/components/inputgroup.md +419 -0
  49. package/data/llms/components/inputmask.md +345 -0
  50. package/data/llms/components/inputnumber.md +551 -0
  51. package/data/llms/components/inputotp.md +345 -0
  52. package/data/llms/components/inputpassword.md +738 -0
  53. package/data/llms/components/inputtags.md +432 -0
  54. package/data/llms/components/inputtext.md +569 -0
  55. package/data/llms/components/installation.md +1 -0
  56. package/data/llms/components/keyfilter.md +116 -0
  57. package/data/llms/components/knob.md +318 -0
  58. package/data/llms/components/label.md +151 -0
  59. package/data/llms/components/laravel.md +53 -0
  60. package/data/llms/components/listbox.md +636 -0
  61. package/data/llms/components/mask.md +203 -0
  62. package/data/llms/components/mcp.md +39 -0
  63. package/data/llms/components/megamenu.md +563 -0
  64. package/data/llms/components/menu.md +651 -0
  65. package/data/llms/components/menubar.md +446 -0
  66. package/data/llms/components/message.md +497 -0
  67. package/data/llms/components/metergroup.md +281 -0
  68. package/data/llms/components/multiselect.md +752 -0
  69. package/data/llms/components/orderlist.md +224 -0
  70. package/data/llms/components/organizationchart.md +418 -0
  71. package/data/llms/components/paginator.md +221 -0
  72. package/data/llms/components/panel.md +321 -0
  73. package/data/llms/components/panelmenu.md +703 -0
  74. package/data/llms/components/password.md +657 -0
  75. package/data/llms/components/picklist.md +286 -0
  76. package/data/llms/components/popover.md +145 -0
  77. package/data/llms/components/progressbar.md +242 -0
  78. package/data/llms/components/progressspinner.md +104 -0
  79. package/data/llms/components/radiobutton.md +427 -0
  80. package/data/llms/components/rating.md +312 -0
  81. package/data/llms/components/ripple.md +91 -0
  82. package/data/llms/components/scrollarea.md +700 -0
  83. package/data/llms/components/scrollpanel.md +131 -0
  84. package/data/llms/components/scrolltop.md +87 -0
  85. package/data/llms/components/select.md +1251 -0
  86. package/data/llms/components/selectbutton.md +268 -0
  87. package/data/llms/components/sidebar.md +2232 -0
  88. package/data/llms/components/skeleton.md +302 -0
  89. package/data/llms/components/slider.md +416 -0
  90. package/data/llms/components/speeddial.md +402 -0
  91. package/data/llms/components/splitbutton.md +840 -0
  92. package/data/llms/components/splitter.md +447 -0
  93. package/data/llms/components/stepper.md +551 -0
  94. package/data/llms/components/styleclass.md +226 -0
  95. package/data/llms/components/tabs.md +609 -0
  96. package/data/llms/components/tag.md +178 -0
  97. package/data/llms/components/terminal.md +123 -0
  98. package/data/llms/components/textarea.md +519 -0
  99. package/data/llms/components/tieredmenu.md +578 -0
  100. package/data/llms/components/timeline.md +494 -0
  101. package/data/llms/components/toast.md +472 -0
  102. package/data/llms/components/togglebutton.md +276 -0
  103. package/data/llms/components/toggleswitch.md +271 -0
  104. package/data/llms/components/toolbar.md +140 -0
  105. package/data/llms/components/tooltip.md +160 -0
  106. package/data/llms/components/tree.md +1076 -0
  107. package/data/llms/components/treeselect.md +660 -0
  108. package/data/llms/components/treetable.md +2493 -0
  109. package/data/llms/components/virtualscroller.md +265 -0
  110. package/data/llms/guides/autoimport.md +28 -0
  111. package/data/llms/guides/cdn.md +72 -0
  112. package/data/llms/guides/configuration.md +158 -0
  113. package/data/llms/guides/customicons.md +67 -0
  114. package/data/llms/guides/guides/accessibility.md +27 -0
  115. package/data/llms/guides/guides/animations.md +119 -0
  116. package/data/llms/guides/guides/rtl.md +7 -0
  117. package/data/llms/guides/icons.md +136 -0
  118. package/data/llms/guides/installation.md +3 -0
  119. package/data/llms/guides/laravel.md +66 -0
  120. package/data/llms/guides/llms.md +15 -0
  121. package/data/llms/guides/mcp.md +104 -0
  122. package/data/llms/guides/migration/v4.md +15 -0
  123. package/data/llms/guides/migration/v5.md +15 -0
  124. package/data/llms/guides/nuxt.md +141 -0
  125. package/data/llms/guides/passthrough.md +137 -0
  126. package/data/llms/guides/primeclt.md +43 -0
  127. package/data/llms/guides/tailwind.md +151 -0
  128. package/data/llms/guides/theming/styled.md +497 -0
  129. package/data/llms/guides/theming/unstyled.md +57 -0
  130. package/data/llms/guides/uikit.md +3 -0
  131. package/data/llms/guides/vite.md +90 -0
  132. package/data/llms/llms-full.txt +54465 -0
  133. package/data/llms/llms.txt +132 -0
  134. package/data/llms/pages/accessibility.md +27 -0
  135. package/data/llms/pages/animations.md +119 -0
  136. package/data/llms/pages/autoimport.md +28 -0
  137. package/data/llms/pages/cdn.md +72 -0
  138. package/data/llms/pages/configuration.md +158 -0
  139. package/data/llms/pages/contribution.md +31 -0
  140. package/data/llms/pages/customicons.md +67 -0
  141. package/data/llms/pages/designer.md +79 -0
  142. package/data/llms/pages/dynamicimports.md +7 -0
  143. package/data/llms/pages/forms.md +63 -0
  144. package/data/llms/pages/guides/accessibility.md +27 -0
  145. package/data/llms/pages/guides/animations.md +119 -0
  146. package/data/llms/pages/guides/rtl.md +7 -0
  147. package/data/llms/pages/icons.md +136 -0
  148. package/data/llms/pages/installation.md +3 -0
  149. package/data/llms/pages/introduction.md +23 -0
  150. package/data/llms/pages/laravel.md +66 -0
  151. package/data/llms/pages/llms.md +15 -0
  152. package/data/llms/pages/mcp.md +104 -0
  153. package/data/llms/pages/migration/v4.md +15 -0
  154. package/data/llms/pages/migration/v5.md +15 -0
  155. package/data/llms/pages/nuxt.md +141 -0
  156. package/data/llms/pages/passthrough.md +137 -0
  157. package/data/llms/pages/primeclt.md +43 -0
  158. package/data/llms/pages/rtl.md +7 -0
  159. package/data/llms/pages/setup.md +3 -0
  160. package/data/llms/pages/styled.md +497 -0
  161. package/data/llms/pages/tailwind.md +151 -0
  162. package/data/llms/pages/theming/styled.md +497 -0
  163. package/data/llms/pages/theming/unstyled.md +57 -0
  164. package/data/llms/pages/uikit.md +3 -0
  165. package/data/llms/pages/unstyled.md +57 -0
  166. package/data/llms/pages/v4.md +15 -0
  167. package/data/llms/pages/v5.md +15 -0
  168. package/data/llms/pages/vite.md +90 -0
  169. package/data/manifest.json +11117 -0
  170. package/data/mcp-data.json +55940 -0
  171. package/dist/index.d.ts +17 -1
  172. package/dist/index.js +66066 -72541
  173. package/package.json +10 -12
@@ -0,0 +1,660 @@
1
+ # TreeSelect
2
+
3
+ TreeSelect is a form component to choose from hierarchical data.
4
+
5
+ ## Basic
6
+
7
+ TreeSelect is used with the v-model property for two-way value binding along with the options collection. Internally Tree component is used so the options model is based on TreeNode API. In single selection mode, value binding should be the key value of a node.
8
+
9
+ ```vue
10
+ <template>
11
+ <div class="flex justify-center">
12
+ <TreeSelect v-model="selectedValue" :options="nodes" placeholder="Select Item" class="md:w-80 w-full" />
13
+ </div>
14
+ </template>
15
+
16
+ <script setup>
17
+ import { ref, onMounted } from 'vue';
18
+ import { NodeService } from './service/NodeService';
19
+
20
+ const nodes = ref(null);
21
+ const selectedValue = ref(null);
22
+
23
+ onMounted(() => {
24
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
25
+ });
26
+ <\/script>
27
+ ```
28
+
29
+ ## Multiple
30
+
31
+ More than one node is selectable by setting selectionMode to multiple . By default in multiple selection mode, metaKey press (e.g. ⌘ ) is necessary to add to existing selections however this can be configured with disabling the metaKeySelection property. Note that in touch enabled devices, TreeSelect always ignores metaKey. In multiple selection mode, value binding should be a key-value pair where key is the node key and value is a boolean to indicate selection.
32
+
33
+ ```vue
34
+ <template>
35
+ <div class="flex justify-center">
36
+ <TreeSelect v-model="selectedValue" :options="nodes" :metaKeySelection="false" selectionMode="multiple" placeholder="Select Item" class="w-full md:w-80" />
37
+ </div>
38
+ </template>
39
+
40
+ <script setup>
41
+ import { ref, onMounted } from 'vue';
42
+ import { NodeService } from './service/NodeService';
43
+
44
+ const nodes = ref(null);
45
+ const selectedValue = ref(null);
46
+
47
+ onMounted(() => {
48
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
49
+ });
50
+ <\/script>
51
+ ```
52
+
53
+ ## Checkbox
54
+
55
+ Selection of multiple nodes via checkboxes is enabled by configuring selectionMode as checkbox .
56
+
57
+ ```vue
58
+ <template>
59
+ <div class="flex justify-center">
60
+ <TreeSelect v-model="selectedValue" :options="nodes" display="chip" :metaKeySelection="false" selectionMode="checkbox" placeholder="Select Item" class="w-full md:w-80" />
61
+ </div>
62
+ </template>
63
+
64
+ <script setup>
65
+ import { ref, onMounted } from 'vue';
66
+ import { NodeService } from './service/NodeService';
67
+
68
+ const nodes = ref(null);
69
+ const selectedValue = ref(null);
70
+
71
+ onMounted(() => {
72
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
73
+ });
74
+ <\/script>
75
+ ```
76
+
77
+ ## Virtual Scroll
78
+
79
+ VirtualScrolling is an efficient way of rendering the options by displaying a small subset of data in the viewport at any time. When dealing with huge number of options, it is suggested to enable VirtualScrolling to avoid performance issues. Usage is simple as setting virtualScroll property to true and defining virtualScrollItemSize to specify the height of an item.
80
+
81
+ ```vue
82
+ <template>
83
+ <div class="flex justify-center">
84
+ <TreeSelect
85
+ v-model="selectedValue"
86
+ :options="nodes"
87
+ display="chip"
88
+ :metaKeySelection="false"
89
+ selectionMode="checkbox"
90
+ placeholder="Select Item"
91
+ :virtualScroll="true"
92
+ :virtualScrollItemSize="35"
93
+ :virtualScrollOptions="{ scrollHeight: '200px' }"
94
+ class="w-full md:w-80"
95
+ />
96
+ </div>
97
+ </template>
98
+
99
+ <script setup>
100
+ import { ref, onMounted } from 'vue';
101
+ import { NodeService } from './service/NodeService';
102
+
103
+ const nodes = ref(null);
104
+ const selectedValue = ref(null);
105
+
106
+ onMounted(() => {
107
+ NodeService.getLargeTreeNodes().then((data) => (nodes.value = data));
108
+ });
109
+ <\/script>
110
+ ```
111
+
112
+ ## Lazy
113
+
114
+ Lazy loading is useful when dealing with huge datasets, in this example nodes are dynamically loaded on demand using loading property and node-expand method.
115
+
116
+ ```vue
117
+ <template>
118
+ <div class="flex justify-center">
119
+ <TreeSelect v-model="selectedValue" :options="nodes" display="chip" :metaKeySelection="false" selectionMode="checkbox" :loading="loading" loadingMode="icon" @node-expand="onNodeExpand" placeholder="Select Item" class="w-full md:w-80" />
120
+ </div>
121
+ </template>
122
+
123
+ <script setup>
124
+ import { ref, onMounted } from 'vue';
125
+
126
+ const nodes = ref(null);
127
+ const selectedValue = ref(null);
128
+ const loading = ref(false);
129
+
130
+ onMounted(() => {
131
+ loading.value = true;
132
+ nodes.value = initiateNodes();
133
+
134
+ setTimeout(() => {
135
+ loading.value = false;
136
+ }, 2000);
137
+ });
138
+
139
+ const onNodeExpand = (node) => {
140
+ if (!node.children) {
141
+ node.loading = true;
142
+
143
+ setTimeout(() => {
144
+ let _node = { ...node };
145
+
146
+ _node.children = [];
147
+
148
+ for (let i = 0; i < 3; i++) {
149
+ _node.children.push({
150
+ key: node.key + '-' + i,
151
+ label: 'Lazy ' + node.label + '-' + i
152
+ });
153
+ }
154
+
155
+ nodes.value[parseInt(node.key, 10)] = { ..._node, loading: false };
156
+ }, 500);
157
+ }
158
+ };
159
+
160
+ const initiateNodes = () => {
161
+ return [
162
+ {
163
+ key: '0',
164
+ label: 'Node 0',
165
+ leaf: false,
166
+ loading: false
167
+ },
168
+ {
169
+ key: '1',
170
+ label: 'Node 1',
171
+ leaf: false,
172
+ loading: false
173
+ },
174
+ {
175
+ key: '2',
176
+ label: 'Node 2',
177
+ leaf: false,
178
+ loading: false
179
+ }
180
+ ];
181
+ };
182
+ <\/script>
183
+ ```
184
+
185
+ ## Filter
186
+
187
+ Filtering is enabled by adding the filter property, by default label property of a node is used to compare against the value in the text field, in order to customize which field(s) should be used during search define filterBy property. In addition filterMode specifies the filtering strategy. In lenient mode when the query matches a node, children of the node are not searched further as all descendants of the node are included. On the other hand, in strict mode when the query matches a node, filtering continues on all descendants.
188
+
189
+ ```vue
190
+ <template>
191
+ <div class="flex justify-center">
192
+ <TreeSelect v-model="selectedValue" :options="nodes" placeholder="Select Item" filter :filterInputAutoFocus="true" class="md:w-80 w-full" />
193
+ </div>
194
+ </template>
195
+
196
+ <script setup>
197
+ import { ref, onMounted } from 'vue';
198
+ import { NodeService } from './service/NodeService';
199
+
200
+ const nodes = ref(null);
201
+ const selectedValue = ref(null);
202
+
203
+ onMounted(() => {
204
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
205
+ });
206
+ <\/script>
207
+ ```
208
+
209
+ ## Template
210
+
211
+ TreeSelect offers multiple slots for customization through templating.
212
+
213
+ ```vue
214
+ <template>
215
+ <div class="flex justify-center">
216
+ <TreeSelect v-model="selectedValue" :options="nodes" placeholder="Select Item" class="md:w-80 w-full">
217
+ <template #dropdownicon>
218
+ <Search />
219
+ </template>
220
+ <template #header>
221
+ <div class="font-medium px-3 py-2">Available Files</div>
222
+ </template>
223
+ <template #footer>
224
+ <div class="px-3 pt-1 pb-2 flex justify-between">
225
+ <Button severity="secondary" text size="small">
226
+ <Plus />
227
+ Add New
228
+ </Button>
229
+ <Button severity="danger" text size="small">
230
+ <Plus />
231
+ Remove All
232
+ </Button>
233
+ </div>
234
+ </template>
235
+ </TreeSelect>
236
+ </div>
237
+ </template>
238
+
239
+ <script setup>
240
+ import Plus from '@primeicons/vue/plus';
241
+ import Search from '@primeicons/vue/search';
242
+ import { ref, onMounted } from 'vue';
243
+ import { NodeService } from './service/NodeService';
244
+
245
+ const nodes = ref(null);
246
+ const selectedValue = ref(null);
247
+
248
+ onMounted(() => {
249
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
250
+ });
251
+ <\/script>
252
+ ```
253
+
254
+ ## Float Label
255
+
256
+ A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
257
+
258
+ ```vue
259
+ <template>
260
+ <div class="flex flex-wrap justify-center items-end gap-4">
261
+ <FloatLabel class="w-full md:w-80">
262
+ <TreeSelect v-model="value1" inputId="over_label" :options="nodes" class="w-full" />
263
+ <label for="over_label">Over Label</label>
264
+ </FloatLabel>
265
+
266
+ <FloatLabel class="w-full md:w-80" variant="in">
267
+ <TreeSelect v-model="value2" inputId="in_label" :options="nodes" class="w-full" />
268
+ <label for="in_label">In Label</label>
269
+ </FloatLabel>
270
+
271
+ <FloatLabel class="w-full md:w-80" variant="on">
272
+ <TreeSelect v-model="value3" inputId="on_label" :options="nodes" class="w-full" />
273
+ <label for="on_label">On Label</label>
274
+ </FloatLabel>
275
+ </div>
276
+ </template>
277
+
278
+ <script setup>
279
+ import { ref, onMounted } from 'vue';
280
+ import { NodeService } from './service/NodeService';
281
+
282
+ const nodes = ref(null);
283
+ const value1 = ref(null);
284
+ const value2 = ref(null);
285
+ const value3 = ref(null);
286
+
287
+ onMounted(() => {
288
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
289
+ });
290
+ <\/script>
291
+ ```
292
+
293
+ ## Ifta Label
294
+
295
+ IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
296
+
297
+ ```vue
298
+ <template>
299
+ <div class="flex justify-center">
300
+ <IftaLabel class="w-full md:w-80">
301
+ <TreeSelect v-model="selectedValue" inputId="t_file" :options="nodes" class="w-full" />
302
+ <label for="t_file">File</label>
303
+ </IftaLabel>
304
+ </div>
305
+ </template>
306
+
307
+ <script setup>
308
+ import { ref, onMounted } from 'vue';
309
+ import { NodeService } from './service/NodeService';
310
+
311
+ const nodes = ref(null);
312
+ const selectedValue = ref(null);
313
+
314
+ onMounted(() => {
315
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
316
+ });
317
+ <\/script>
318
+ ```
319
+
320
+ ## Clear Icon
321
+
322
+ When showClear is enabled, a clear icon is displayed to clear the value.
323
+
324
+ ```vue
325
+ <template>
326
+ <div class="flex justify-center">
327
+ <TreeSelect v-model="selectedValue" showClear :options="nodes" placeholder="Select Item" class="md:w-80 w-full" />
328
+ </div>
329
+ </template>
330
+
331
+ <script setup>
332
+ import { ref, onMounted } from 'vue';
333
+ import { NodeService } from './service/NodeService';
334
+
335
+ const nodes = ref(null);
336
+ const selectedValue = ref(null);
337
+
338
+ onMounted(() => {
339
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
340
+ });
341
+ <\/script>
342
+ ```
343
+
344
+ ## Sizes
345
+
346
+ TreeSelect provides small and large sizes as alternatives to the base.
347
+
348
+ ```vue
349
+ <template>
350
+ <div class="flex flex-col items-center gap-4">
351
+ <TreeSelect v-model="value1" :options="nodes" size="small" placeholder="Small" class="md:w-80 w-full" />
352
+ <TreeSelect v-model="value2" :options="nodes" placeholder="Normal" class="md:w-80 w-full" />
353
+ <TreeSelect v-model="value3" :options="nodes" size="large" placeholder="Large" class="md:w-80 w-full" />
354
+ </div>
355
+ </template>
356
+
357
+ <script setup>
358
+ import { ref, onMounted } from 'vue';
359
+ import { NodeService } from './service/NodeService';
360
+
361
+ const value1 = ref(null);
362
+ const value2 = ref(null);
363
+ const value3 = ref(null);
364
+ const nodes = ref(null);
365
+
366
+ onMounted(() => {
367
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
368
+ });
369
+ <\/script>
370
+ ```
371
+
372
+ ## Fluid
373
+
374
+ The fluid prop makes the component take up the full width of its container when set to true.
375
+
376
+ ```vue
377
+ <template>
378
+ <div>
379
+ <TreeSelect v-model="selectedValue" :options="nodes" placeholder="Select Item" fluid />
380
+ </div>
381
+ </template>
382
+
383
+ <script setup>
384
+ import { ref, onMounted } from 'vue';
385
+ import { NodeService } from './service/NodeService';
386
+
387
+ const nodes = ref(null);
388
+ const selectedValue = ref(null);
389
+
390
+ onMounted(() => {
391
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
392
+ });
393
+ <\/script>
394
+ ```
395
+
396
+ ## Filled
397
+
398
+ Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
399
+
400
+ ```vue
401
+ <template>
402
+ <div class="flex justify-center">
403
+ <TreeSelect v-model="selectedValue" variant="filled" :options="nodes" placeholder="Select Item" class="md:w-80 w-full" />
404
+ </div>
405
+ </template>
406
+
407
+ <script setup>
408
+ import { ref, onMounted } from 'vue';
409
+ import { NodeService } from './service/NodeService';
410
+
411
+ const nodes = ref(null);
412
+ const selectedValue = ref(null);
413
+
414
+ onMounted(() => {
415
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
416
+ });
417
+ <\/script>
418
+ ```
419
+
420
+ ## Disabled
421
+
422
+ When disabled is present, the element cannot be edited and focused.
423
+
424
+ ```vue
425
+ <template>
426
+ <div class="flex justify-center">
427
+ <TreeSelect v-model="selectedValue" disabled class="md:w-80 w-full" :options="nodes" placeholder="TreeSelect" />
428
+ </div>
429
+ </template>
430
+
431
+ <script setup>
432
+ import { ref, onMounted } from 'vue';
433
+ import { NodeService } from './service/NodeService';
434
+
435
+ const nodes = ref(null);
436
+ const selectedValue = ref(null);
437
+
438
+ onMounted(() => {
439
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
440
+ });
441
+ <\/script>
442
+ ```
443
+
444
+ ## Invalid
445
+
446
+ The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation libraries.
447
+
448
+ ```vue
449
+ <template>
450
+ <div class="flex flex-wrap justify-center gap-4">
451
+ <TreeSelect v-model="selectedValue1" :invalid="selectedValue1 === undefined" :options="nodes" placeholder="TreeSelect" class="md:w-80 w-full" />
452
+ <TreeSelect v-model="selectedValue2" variant="filled" :invalid="selectedValue2 === undefined" :options="nodes" placeholder="TreeSelect" class="md:w-80 w-full" />
453
+ </div>
454
+ </template>
455
+
456
+ <script setup>
457
+ import { ref, onMounted } from 'vue';
458
+ import { NodeService } from './service/NodeService';
459
+
460
+ const nodes = ref(null);
461
+ const selectedValue1 = ref(undefined);
462
+ const selectedValue2 = ref(undefined);
463
+
464
+ onMounted(() => {
465
+ NodeService.getTreeNodes().then((data) => (nodes.value = data));
466
+ });
467
+ <\/script>
468
+ ```
469
+
470
+ ## Forms
471
+
472
+ TreeSelect is used with the v-model property.
473
+
474
+ ```vue
475
+ <template>
476
+ <div class="flex justify-center">
477
+ <Form v-slot="$form" :resolver="resolver" :initialValues="initialValues" @submit="onFormSubmit" class="flex flex-col gap-4 w-full md:w-80">
478
+ <div class="flex flex-col gap-1">
479
+ <TreeSelect name="node" :options="nodes" placeholder="Select Item" fluid />
480
+ <Message v-if="$form.node?.invalid" severity="error" size="small" variant="simple">{{ $form.node.error?.message }}</Message>
481
+ </div>
482
+ <Button type="submit" severity="secondary">Submit</Button>
483
+ </Form>
484
+ </div>
485
+ </template>
486
+
487
+ <script setup>
488
+ import { ref } from 'vue';
489
+ import { zodResolver } from '@primevue/forms/resolvers/zod';
490
+ import { useToast } from "primevue/usetoast";
491
+ import { z } from 'zod';
492
+ import { NodeService } from '/service/NodeService';
493
+
494
+ const toast = useToast();
495
+ const initialValues = ref({
496
+ node: null
497
+ });
498
+ const resolver = ref(zodResolver(
499
+ z.object({
500
+ node: z.union([z.record(z.boolean()), z.literal(null)]).refine((obj) => obj !== null && Object.keys(obj).length > 0, { message: 'Selection is required.' })
501
+ })
502
+ ));
503
+
504
+ const onFormSubmit = ({ valid }) => {
505
+ if (valid) {
506
+ toast.add({ severity: 'success', summary: 'Form is submitted.', life: 3000 });
507
+ }
508
+ };
509
+ <\/script>
510
+ ```
511
+
512
+ ## Accessibility
513
+
514
+ Screen Reader Value to describe the component can either be provided with aria-labelledby or aria-label props. The treeselect element has a combobox role in addition to aria-haspopup and aria-expanded attributes. The relation between the combobox and the popup is created with aria-controls that refers to the id of the popup. The popup list has an id that refers to the aria-controls attribute of the combobox element and uses tree as the role. Each list item has a treeitem role along with aria-label , aria-selected and aria-expanded attributes. In checkbox selection, aria-checked is used instead of aria-selected . Checkbox and toggle icons are hidden from screen readers as their parent element with treeitem role and attributes are used instead for readers and keyboard support. The container element of a treenode has the group role. The aria-setsize , aria-posinset and aria-level attributes are calculated implicitly and added to each treeitem. If filtering is enabled, filterInputProps can be defined to give aria-* props to the filter input element. Closed State Keyboard Support Key Function tab Moves focus to the treeselect element. space Opens the popup and moves visual focus to the selected treenode, if there is none then first treenode receives the focus. down arrow Opens the popup and moves visual focus to the selected option, if there is none then first option receives the focus. Popup Keyboard Support Key Function tab Moves focus to the next focusable element in the popup, if there is none then first focusable element receives the focus. shift + tab Moves focus to the previous focusable element in the popup, if there is none then last focusable element receives the focus. enter Selects the focused option, closes the popup if selection mode is single. space Selects the focused option, closes the popup if selection mode is single. escape Closes the popup, moves focus to the treeselect element. down arrow Moves focus to the next treenode. up arrow Moves focus to the previous treenode. right arrow If node is closed, opens the node otherwise moves focus to the first child node. left arrow If node is open, closes the node otherwise moves focus to the parent node. Filter Input Keyboard Support Key Function enter Closes the popup and moves focus to the treeselect element. escape Closes the popup and moves focus to the treeselect element. Close Button Keyboard Support Key Function enter Closes the popup and moves focus to the treeselect element. space Closes the popup and moves focus to the treeselect element. escape Closes the popup and moves focus to the treeselect element.
515
+
516
+ ```vue
517
+ <template>
518
+ <span id="dd1">Options</span>
519
+ <TreeSelect aria-labelledby="dd1" />
520
+
521
+ <TreeSelect aria-label="Options" />
522
+ </template>
523
+ ```
524
+
525
+ ## Tree Select API
526
+
527
+ ### Props
528
+
529
+ | Name |Type |Default |Description |
530
+ | --- | --- | --- | --- |
531
+ | modelValue | any | - | Value of the component. |
532
+ | defaultValue | any | - | The default value for the input when not controlled by `modelValue` . |
533
+ | name | string | - | The name attribute for the element, typically used in form submissions. |
534
+ | options | TreeNode[] | - | An array of treenodes. |
535
+ | expandedKeys | any | - | A map of keys to represent the expansion state in controlled mode. |
536
+ | showClear | boolean | false | When enabled, a clear icon is displayed to clear the value. |
537
+ | clearIcon | string | - | Icon to display in clear button. |
538
+ | scrollHeight | string | 20rem | Height of the viewport, a scrollbar is defined if height of list exceeds this value. |
539
+ | selectionMode | HintedString<"single" \| "multiple" \| "checkbox"> | - | Defines the selection mode. |
540
+ | fluid | boolean | null | Spans 100% width of the container when enabled. |
541
+ | appendTo | HTMLElement \| HintedString<"body" \| "self"> | body | A valid query selector or an HTMLElement to specify where the overlay gets attached. |
542
+ | display | HintedString<"comma" \| "chip"> | comma | Defines how the selected items are displayed. |
543
+ | selectedItemsLabel | string | null | Label to display after exceeding max selected labels. |
544
+ | maxSelectedLabels | number | - | Decides how many selected item labels to show at most. |
545
+ | metaKeySelection | boolean | false | Defines how multiple items can be selected, when true metaKey needs to be pressed to select or unselect an item and when set to false selection of each item can be toggled individually. On touch enabled devices, metaKeySelection is turned off automatically. |
546
+ | loading | boolean | false | Whether to display loading indicator. |
547
+ | loadingIcon | string | - | Icon to display when tree is loading. |
548
+ | loadingMode | HintedString<"icon" \| "mask"> | mask | Loading mode display. |
549
+ | filter | boolean | false | When specified, displays an input field to filter the items. |
550
+ | filterBy | string \| Function | label | When filtering is enabled, filterBy decides which field or fields (comma separated) to search against. A callable taking a TreeNode can be provided instead of a list of field names. |
551
+ | filterMode | HintedString<"lenient" \| "strict"> | lenient | Mode for filtering. |
552
+ | filterPlaceholder | string | - | Placeholder text to show when filter input is empty. |
553
+ | filterLocale | string | - | Locale to use in filtering. The default locale is the host environment's current locale. |
554
+ | emptyMessage | string | No available options | Text to display when there are no options available. Defaults to value from PrimeVue locale configuration. |
555
+ | placeholder | string | - | Label to display when there are no selections. |
556
+ | size | HintedString<"small" \| "large"> | - | Defines the size of the component. |
557
+ | invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
558
+ | disabled | boolean | false | When present, it specifies that the component should be disabled. |
559
+ | variant | null \| HintedString<"outlined" \| "filled"> | null | Specifies the input variant of the component. |
560
+ | tabindex | string | - | Index of the element in tabbing order. |
561
+ | inputId | string | - | Identifier of the underlying input element. |
562
+ | inputClass | string \| object | - | Style class of the input field. |
563
+ | inputStyle | object | - | Inline style of the input field. |
564
+ | inputProps | InputHTMLAttributes | - | Used to pass all properties of the HTMLInputElement to the focusable input element inside the component. |
565
+ | panelClass | any | - | Style class of the overlay panel. |
566
+ | ariaLabelledby | string | - | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
567
+ | ariaLabel | string | - | Establishes a string value that labels the component. |
568
+ | formControl | Record<string, any> | - | Form control object, typically used for handling validation and form state. |
569
+ | dt | any | - | It generates scoped CSS variables using design tokens for the component. |
570
+ | pt | PassThrough<TreeSelectPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
571
+ | ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
572
+ | unstyled | boolean | false | When enabled, it removes component related styles in the core. |
573
+
574
+ ### Pass Through Options
575
+
576
+ | Name |Type |Description |
577
+ | --- | --- | --- |
578
+ | root | TreeSelectPassThroughOptionType | Used to pass attributes to the root's DOM element. |
579
+ | labelContainer | TreeSelectPassThroughOptionType | Used to pass attributes to the label container's DOM element. |
580
+ | label | TreeSelectPassThroughOptionType | Used to pass attributes to the label's DOM element. |
581
+ | clearIcon | TreeSelectPassThroughOptionType | Used to pass attributes to the clear icon's DOM element. |
582
+ | chipItem | TreeSelectPassThroughOptionType | Used to pass attributes to the chip's DOM element. |
583
+ | pcChip | any | Used to pass attributes to the Chip. |
584
+ | dropdown | TreeSelectPassThroughOptionType | Used to pass attributes to the dropdown's DOM element. |
585
+ | dropdownIcon | TreeSelectPassThroughOptionType | Used to pass attributes to the dropdown icon's DOM element. |
586
+ | panel | TreeSelectPassThroughOptionType | Used to pass attributes to the panel's DOM element. |
587
+ | treeContainer | TreeSelectPassThroughOptionType | Used to pass attributes to the tree container's DOM element. |
588
+ | pcTree | any | Used to pass attributes to Tree component. |
589
+ | emptyMessage | TreeSelectPassThroughOptionType | Used to pass attributes to the empty message's DOM element. |
590
+ | hiddenInputContainer | TreeSelectPassThroughOptionType | Used to pass attributes to the hidden input container's DOM element. |
591
+ | hiddenInput | TreeSelectPassThroughOptionType | Used to pass attributes to the hidden input's DOM element. |
592
+ | hooks | any | Used to manage all lifecycle hooks. |
593
+ | transition | TreeSelectPassThroughTransitionType | Used to control Vue Transition API. |
594
+
595
+ ### Theming
596
+
597
+ ### CSS Classes
598
+
599
+ | Class |Description |
600
+ | --- | --- |
601
+ | p-treeselect | Class name of the root element |
602
+ | p-treeselect-label-container | Class name of the label container element |
603
+ | p-treeselect-label | Class name of the label element |
604
+ | p-select-clear-icon | Class name of the clear icon element |
605
+ | p-treeselect-chip-item | Class name of the chip item element |
606
+ | p-treeselect-chip | Class name of the chip element |
607
+ | p-treeselect-dropdown | Class name of the dropdown element |
608
+ | p-treeselect-dropdown-icon | Class name of the dropdown icon element |
609
+ | p-treeselect-overlay | Class name of the panel element |
610
+ | p-treeselect-tree-container | Class name of the tree container element |
611
+ | p-treeselect-empty-message | Class name of the empty message element |
612
+
613
+ ### Design Tokens
614
+
615
+ | Token |CSS Variable |Description |
616
+ | --- | --- | --- |
617
+ | treeselect.background | --p-treeselect-background | Background of root |
618
+ | treeselect.disabled.background | --p-treeselect-disabled-background | Disabled background of root |
619
+ | treeselect.filled.background | --p-treeselect-filled-background | Filled background of root |
620
+ | treeselect.filled.hover.background | --p-treeselect-filled-hover-background | Filled hover background of root |
621
+ | treeselect.filled.focus.background | --p-treeselect-filled-focus-background | Filled focus background of root |
622
+ | treeselect.border.color | --p-treeselect-border-color | Border color of root |
623
+ | treeselect.hover.border.color | --p-treeselect-hover-border-color | Hover border color of root |
624
+ | treeselect.focus.border.color | --p-treeselect-focus-border-color | Focus border color of root |
625
+ | treeselect.invalid.border.color | --p-treeselect-invalid-border-color | Invalid border color of root |
626
+ | treeselect.color | --p-treeselect-color | Color of root |
627
+ | treeselect.disabled.color | --p-treeselect-disabled-color | Disabled color of root |
628
+ | treeselect.placeholder.color | --p-treeselect-placeholder-color | Placeholder color of root |
629
+ | treeselect.invalid.placeholder.color | --p-treeselect-invalid-placeholder-color | Invalid placeholder color of root |
630
+ | treeselect.shadow | --p-treeselect-shadow | Shadow of root |
631
+ | treeselect.padding.x | --p-treeselect-padding-x | Padding x of root |
632
+ | treeselect.padding.y | --p-treeselect-padding-y | Padding y of root |
633
+ | treeselect.border.radius | --p-treeselect-border-radius | Border radius of root |
634
+ | treeselect.focus.ring.width | --p-treeselect-focus-ring-width | Focus ring width of root |
635
+ | treeselect.focus.ring.style | --p-treeselect-focus-ring-style | Focus ring style of root |
636
+ | treeselect.focus.ring.color | --p-treeselect-focus-ring-color | Focus ring color of root |
637
+ | treeselect.focus.ring.offset | --p-treeselect-focus-ring-offset | Focus ring offset of root |
638
+ | treeselect.focus.ring.shadow | --p-treeselect-focus-ring-shadow | Focus ring shadow of root |
639
+ | treeselect.transition.duration | --p-treeselect-transition-duration | Transition duration of root |
640
+ | treeselect.sm.font.size | --p-treeselect-sm-font-size | Sm font size of root |
641
+ | treeselect.sm.padding.x | --p-treeselect-sm-padding-x | Sm padding x of root |
642
+ | treeselect.sm.padding.y | --p-treeselect-sm-padding-y | Sm padding y of root |
643
+ | treeselect.lg.font.size | --p-treeselect-lg-font-size | Lg font size of root |
644
+ | treeselect.lg.padding.x | --p-treeselect-lg-padding-x | Lg padding x of root |
645
+ | treeselect.lg.padding.y | --p-treeselect-lg-padding-y | Lg padding y of root |
646
+ | treeselect.font.weight | --p-treeselect-font-weight | Font weight of root |
647
+ | treeselect.font.size | --p-treeselect-font-size | Font size of root |
648
+ | treeselect.dropdown.width | --p-treeselect-dropdown-width | Width of dropdown |
649
+ | treeselect.dropdown.color | --p-treeselect-dropdown-color | Color of dropdown |
650
+ | treeselect.overlay.background | --p-treeselect-overlay-background | Background of overlay |
651
+ | treeselect.overlay.border.color | --p-treeselect-overlay-border-color | Border color of overlay |
652
+ | treeselect.overlay.border.radius | --p-treeselect-overlay-border-radius | Border radius of overlay |
653
+ | treeselect.overlay.color | --p-treeselect-overlay-color | Color of overlay |
654
+ | treeselect.overlay.shadow | --p-treeselect-overlay-shadow | Shadow of overlay |
655
+ | treeselect.tree.padding | --p-treeselect-tree-padding | Padding of tree |
656
+ | treeselect.clear.icon.color | --p-treeselect-clear-icon-color | Color of clear icon |
657
+ | treeselect.empty.message.padding | --p-treeselect-empty-message-padding | Padding of empty message |
658
+ | treeselect.chip.border.radius | --p-treeselect-chip-border-radius | Border radius of chip |
659
+
660
+ ## Tree Node API