@exhaustive-ui/mcp 0.0.0-stage → 3.0.0-alpha.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 (121) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +167 -2
  3. package/data/components/accordion.md +421 -0
  4. package/data/components/animateonscroll.md +163 -0
  5. package/data/components/autocomplete.md +1077 -0
  6. package/data/components/autofocus.md +38 -0
  7. package/data/components/avatar.md +417 -0
  8. package/data/components/badge.md +234 -0
  9. package/data/components/blockui.md +108 -0
  10. package/data/components/breadcrumb.md +178 -0
  11. package/data/components/button.md +774 -0
  12. package/data/components/card.md +138 -0
  13. package/data/components/carousel.md +440 -0
  14. package/data/components/cascadeselect.md +1387 -0
  15. package/data/components/chart.md +1178 -0
  16. package/data/components/checkbox.md +529 -0
  17. package/data/components/chip.md +180 -0
  18. package/data/components/colorpicker.md +301 -0
  19. package/data/components/confirmdialog.md +287 -0
  20. package/data/components/confirmpopup.md +417 -0
  21. package/data/components/contextmenu.md +491 -0
  22. package/data/components/dataview.md +600 -0
  23. package/data/components/datepicker.md +1262 -0
  24. package/data/components/dialog.md +622 -0
  25. package/data/components/divider.md +250 -0
  26. package/data/components/dock.md +500 -0
  27. package/data/components/dragdrop.md +285 -0
  28. package/data/components/drawer.md +510 -0
  29. package/data/components/dynamicdialog.md +109 -0
  30. package/data/components/editor.md +291 -0
  31. package/data/components/fieldset.md +182 -0
  32. package/data/components/fileupload.md +430 -0
  33. package/data/components/floatlabel.md +155 -0
  34. package/data/components/fluid.md +72 -0
  35. package/data/components/focustrap.md +65 -0
  36. package/data/components/galleria.md +627 -0
  37. package/data/components/iconfield.md +246 -0
  38. package/data/components/iftalabel.md +105 -0
  39. package/data/components/imagecompare.md +97 -0
  40. package/data/components/inplace.md +233 -0
  41. package/data/components/inputgroup.md +306 -0
  42. package/data/components/inputmask.md +518 -0
  43. package/data/components/inputnumber.md +675 -0
  44. package/data/components/inputotp.md +336 -0
  45. package/data/components/inputtext.md +488 -0
  46. package/data/components/keyfilter.md +85 -0
  47. package/data/components/knob.md +462 -0
  48. package/data/components/listbox.md +798 -0
  49. package/data/components/llms.md +28 -0
  50. package/data/components/megamenu.md +587 -0
  51. package/data/components/menu.md +483 -0
  52. package/data/components/menubar.md +462 -0
  53. package/data/components/message.md +449 -0
  54. package/data/components/metergroup.md +241 -0
  55. package/data/components/multiselect.md +1047 -0
  56. package/data/components/orderlist.md +342 -0
  57. package/data/components/organizationchart.md +197 -0
  58. package/data/components/overlay.md +217 -0
  59. package/data/components/paginator.md +314 -0
  60. package/data/components/panel.md +214 -0
  61. package/data/components/panelmenu.md +699 -0
  62. package/data/components/password.md +570 -0
  63. package/data/components/picklist.md +420 -0
  64. package/data/components/popover.md +378 -0
  65. package/data/components/progressbar.md +181 -0
  66. package/data/components/progressspinner.md +91 -0
  67. package/data/components/radiobutton.md +377 -0
  68. package/data/components/rating.md +312 -0
  69. package/data/components/ripple.md +89 -0
  70. package/data/components/scroller.md +122 -0
  71. package/data/components/scrollpanel.md +149 -0
  72. package/data/components/scrolltop.md +105 -0
  73. package/data/components/select.md +1206 -0
  74. package/data/components/selectbutton.md +356 -0
  75. package/data/components/skeleton.md +242 -0
  76. package/data/components/slider.md +337 -0
  77. package/data/components/speeddial.md +589 -0
  78. package/data/components/splitbutton.md +945 -0
  79. package/data/components/splitter.md +196 -0
  80. package/data/components/stepper.md +411 -0
  81. package/data/components/styleclass.md +126 -0
  82. package/data/components/table.md +4557 -0
  83. package/data/components/tabs.md +467 -0
  84. package/data/components/tag.md +200 -0
  85. package/data/components/terminal.md +118 -0
  86. package/data/components/textarea.md +416 -0
  87. package/data/components/tieredmenu.md +578 -0
  88. package/data/components/timeline.md +310 -0
  89. package/data/components/toast.md +596 -0
  90. package/data/components/togglebutton.md +356 -0
  91. package/data/components/toggleswitch.md +285 -0
  92. package/data/components/toolbar.md +182 -0
  93. package/data/components/tooltip.md +211 -0
  94. package/data/components/tree.md +746 -0
  95. package/data/components/treeselect.md +912 -0
  96. package/data/components/treetable.md +2814 -0
  97. package/data/components.json +43751 -0
  98. package/data/llms-full.txt +47433 -0
  99. package/data/llms.txt +121 -0
  100. package/data/manifest.json +46513 -0
  101. package/data/pages/accessibility.md +28 -0
  102. package/data/pages/animations.md +28 -0
  103. package/data/pages/configuration.md +210 -0
  104. package/data/pages/contribution.md +20 -0
  105. package/data/pages/customicons.md +20 -0
  106. package/data/pages/faq.md +20 -0
  107. package/data/pages/icons.md +66 -0
  108. package/data/pages/installation.md +71 -0
  109. package/data/pages/llms.md +61 -0
  110. package/data/pages/passthrough.md +32 -0
  111. package/data/pages/philosophy.md +28 -0
  112. package/data/pages/primeflex.md +20 -0
  113. package/data/pages/rtl.md +12 -0
  114. package/data/pages/styled.md +132 -0
  115. package/data/pages/tailwind.md +40 -0
  116. package/data/pages/unstyled.md +39 -0
  117. package/data/snapshot.json +9 -0
  118. package/dist/index.d.mts +448 -0
  119. package/dist/index.mjs +2501 -0
  120. package/dist/index.mjs.map +1 -0
  121. package/package.json +67 -3
@@ -0,0 +1,1387 @@
1
+ # Angular CascadeSelect Component
2
+
3
+ CascadeSelect displays a nested structure of options.
4
+
5
+ ## Accessibility
6
+
7
+ Screen Reader Value to describe the component can either be provided with ariaLabelledBy or ariaLabel props. The cascadeselect 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. 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.
8
+
9
+ ## Basic
10
+
11
+ CascadeSelect requires a value to bind and a collection of arbitrary objects with a nested hierarchy. optionGroupLabel is used for the text of a category and optionGroupChildren is to define the children of the category. Note that order of the optionGroupChildren matters and it should correspond to the data hierarchy.
12
+
13
+ ```typescript
14
+ import { Component, OnInit } from '@angular/core';
15
+ import { FormsModule } from '@angular/forms';
16
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
17
+
18
+ @Component({
19
+ template: `
20
+ <div class="card flex justify-center">
21
+ <p-cascadeselect [(ngModel)]="selectedCity" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" [style]="{ minWidth: '14rem' }" placeholder="Select a City" />
22
+ </div>
23
+ `,
24
+ standalone: true,
25
+ imports: [CascadeSelectModule, FormsModule]
26
+ })
27
+ export class CascadeselectBasicDemo implements OnInit {
28
+ countries: any[] | undefined;
29
+ selectedCity: any;
30
+
31
+ ngOnInit() {
32
+ this.countries = [
33
+ {
34
+ name: 'Australia',
35
+ code: 'AU',
36
+ states: [
37
+ {
38
+ name: 'New South Wales',
39
+ cities: [
40
+ { cname: 'Sydney', code: 'A-SY' },
41
+ { cname: 'Newcastle', code: 'A-NE' },
42
+ { cname: 'Wollongong', code: 'A-WO' }
43
+ ]
44
+ },
45
+ {
46
+ name: 'Queensland',
47
+ cities: [
48
+ { cname: 'Brisbane', code: 'A-BR' },
49
+ { cname: 'Townsville', code: 'A-TO' }
50
+ ]
51
+ }
52
+ ]
53
+ },
54
+ {
55
+ name: 'Canada',
56
+ code: 'CA',
57
+ states: [
58
+ {
59
+ name: 'Quebec',
60
+ cities: [
61
+ { cname: 'Montreal', code: 'C-MO' },
62
+ { cname: 'Quebec City', code: 'C-QU' }
63
+ ]
64
+ },
65
+ {
66
+ name: 'Ontario',
67
+ cities: [
68
+ { cname: 'Ottawa', code: 'C-OT' },
69
+ { cname: 'Toronto', code: 'C-TO' }
70
+ ]
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ name: 'United States',
76
+ code: 'US',
77
+ states: [
78
+ {
79
+ name: 'California',
80
+ cities: [
81
+ { cname: 'Los Angeles', code: 'US-LA' },
82
+ { cname: 'San Diego', code: 'US-SD' },
83
+ { cname: 'San Francisco', code: 'US-SF' }
84
+ ]
85
+ },
86
+ {
87
+ name: 'Florida',
88
+ cities: [
89
+ { cname: 'Jacksonville', code: 'US-JA' },
90
+ { cname: 'Miami', code: 'US-MI' },
91
+ { cname: 'Tampa', code: 'US-TA' },
92
+ { cname: 'Orlando', code: 'US-OR' }
93
+ ]
94
+ },
95
+ {
96
+ name: 'Texas',
97
+ cities: [
98
+ { cname: 'Austin', code: 'US-AU' },
99
+ { cname: 'Dallas', code: 'US-DA' },
100
+ { cname: 'Houston', code: 'US-HO' }
101
+ ]
102
+ }
103
+ ]
104
+ }
105
+ ];
106
+ }
107
+ }
108
+ ```
109
+
110
+ ## Clear Icon
111
+
112
+ When showClear is enabled, a clear icon is displayed to clear the value.
113
+
114
+ ```typescript
115
+ import { Component, OnInit } from '@angular/core';
116
+ import { FormsModule } from '@angular/forms';
117
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
118
+
119
+ @Component({
120
+ template: `
121
+ <div class="card flex justify-center">
122
+ <p-cascadeselect [(ngModel)]="selectedCity" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" placeholder="Select a City" [style]="{ minWidth: '14rem' }" [showClear]="true" />
123
+ </div>
124
+ `,
125
+ standalone: true,
126
+ imports: [CascadeSelectModule, FormsModule]
127
+ })
128
+ export class CascadeselectCleariconDemo implements OnInit {
129
+ countries: any[] | undefined;
130
+ selectedCity: any;
131
+
132
+ ngOnInit() {
133
+ this.countries = [
134
+ {
135
+ name: 'Australia',
136
+ code: 'AU',
137
+ states: [
138
+ {
139
+ name: 'New South Wales',
140
+ cities: [
141
+ { cname: 'Sydney', code: 'A-SY' },
142
+ { cname: 'Newcastle', code: 'A-NE' },
143
+ { cname: 'Wollongong', code: 'A-WO' }
144
+ ]
145
+ },
146
+ {
147
+ name: 'Queensland',
148
+ cities: [
149
+ { cname: 'Brisbane', code: 'A-BR' },
150
+ { cname: 'Townsville', code: 'A-TO' }
151
+ ]
152
+ }
153
+ ]
154
+ },
155
+ {
156
+ name: 'Canada',
157
+ code: 'CA',
158
+ states: [
159
+ {
160
+ name: 'Quebec',
161
+ cities: [
162
+ { cname: 'Montreal', code: 'C-MO' },
163
+ { cname: 'Quebec City', code: 'C-QU' }
164
+ ]
165
+ },
166
+ {
167
+ name: 'Ontario',
168
+ cities: [
169
+ { cname: 'Ottawa', code: 'C-OT' },
170
+ { cname: 'Toronto', code: 'C-TO' }
171
+ ]
172
+ }
173
+ ]
174
+ },
175
+ {
176
+ name: 'United States',
177
+ code: 'US',
178
+ states: [
179
+ {
180
+ name: 'California',
181
+ cities: [
182
+ { cname: 'Los Angeles', code: 'US-LA' },
183
+ { cname: 'San Diego', code: 'US-SD' },
184
+ { cname: 'San Francisco', code: 'US-SF' }
185
+ ]
186
+ },
187
+ {
188
+ name: 'Florida',
189
+ cities: [
190
+ { cname: 'Jacksonville', code: 'US-JA' },
191
+ { cname: 'Miami', code: 'US-MI' },
192
+ { cname: 'Tampa', code: 'US-TA' },
193
+ { cname: 'Orlando', code: 'US-OR' }
194
+ ]
195
+ },
196
+ {
197
+ name: 'Texas',
198
+ cities: [
199
+ { cname: 'Austin', code: 'US-AU' },
200
+ { cname: 'Dallas', code: 'US-DA' },
201
+ { cname: 'Houston', code: 'US-HO' }
202
+ ]
203
+ }
204
+ ]
205
+ }
206
+ ];
207
+ }
208
+ }
209
+ ```
210
+
211
+ ## Disabled
212
+
213
+ When disabled is present, the element cannot be edited and focused.
214
+
215
+ ```typescript
216
+ import { Component } from '@angular/core';
217
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
218
+
219
+ @Component({
220
+ template: `
221
+ <div class="card flex justify-center">
222
+ <p-cascadeselect [disabled]="true" placeholder="Disabled" [style]="{ minWidth: '14rem' }" />
223
+ </div>
224
+ `,
225
+ standalone: true,
226
+ imports: [CascadeSelectModule]
227
+ })
228
+ export class CascadeselectDisabledDemo {}
229
+ ```
230
+
231
+ ## Filled
232
+
233
+ Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
234
+
235
+ ```typescript
236
+ import { Component, OnInit } from '@angular/core';
237
+ import { FormsModule } from '@angular/forms';
238
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
239
+
240
+ @Component({
241
+ template: `
242
+ <div class="card flex justify-center">
243
+ <p-cascadeselect [(ngModel)]="selectedCity" variant="filled" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" [style]="{ minWidth: '14rem' }" placeholder="Select a City" />
244
+ </div>
245
+ `,
246
+ standalone: true,
247
+ imports: [CascadeSelectModule, FormsModule]
248
+ })
249
+ export class CascadeselectFilledDemo implements OnInit {
250
+ countries: any[] | undefined;
251
+ selectedCity: any;
252
+
253
+ ngOnInit() {
254
+ this.countries = [
255
+ {
256
+ name: 'Australia',
257
+ code: 'AU',
258
+ states: [
259
+ {
260
+ name: 'New South Wales',
261
+ cities: [
262
+ { cname: 'Sydney', code: 'A-SY' },
263
+ { cname: 'Newcastle', code: 'A-NE' },
264
+ { cname: 'Wollongong', code: 'A-WO' }
265
+ ]
266
+ },
267
+ {
268
+ name: 'Queensland',
269
+ cities: [
270
+ { cname: 'Brisbane', code: 'A-BR' },
271
+ { cname: 'Townsville', code: 'A-TO' }
272
+ ]
273
+ }
274
+ ]
275
+ },
276
+ {
277
+ name: 'Canada',
278
+ code: 'CA',
279
+ states: [
280
+ {
281
+ name: 'Quebec',
282
+ cities: [
283
+ { cname: 'Montreal', code: 'C-MO' },
284
+ { cname: 'Quebec City', code: 'C-QU' }
285
+ ]
286
+ },
287
+ {
288
+ name: 'Ontario',
289
+ cities: [
290
+ { cname: 'Ottawa', code: 'C-OT' },
291
+ { cname: 'Toronto', code: 'C-TO' }
292
+ ]
293
+ }
294
+ ]
295
+ },
296
+ {
297
+ name: 'United States',
298
+ code: 'US',
299
+ states: [
300
+ {
301
+ name: 'California',
302
+ cities: [
303
+ { cname: 'Los Angeles', code: 'US-LA' },
304
+ { cname: 'San Diego', code: 'US-SD' },
305
+ { cname: 'San Francisco', code: 'US-SF' }
306
+ ]
307
+ },
308
+ {
309
+ name: 'Florida',
310
+ cities: [
311
+ { cname: 'Jacksonville', code: 'US-JA' },
312
+ { cname: 'Miami', code: 'US-MI' },
313
+ { cname: 'Tampa', code: 'US-TA' },
314
+ { cname: 'Orlando', code: 'US-OR' }
315
+ ]
316
+ },
317
+ {
318
+ name: 'Texas',
319
+ cities: [
320
+ { cname: 'Austin', code: 'US-AU' },
321
+ { cname: 'Dallas', code: 'US-DA' },
322
+ { cname: 'Houston', code: 'US-HO' }
323
+ ]
324
+ }
325
+ ]
326
+ }
327
+ ];
328
+ }
329
+ }
330
+ ```
331
+
332
+ ## floatlabel-doc
333
+
334
+ A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
335
+
336
+ ```typescript
337
+ import { Component, OnInit } from '@angular/core';
338
+ import { FormsModule } from '@angular/forms';
339
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
340
+ import { FloatLabelModule } from '@exhaustive-ui/core/floatlabel';
341
+
342
+ @Component({
343
+ template: `
344
+ <div class="card flex flex-wrap justify-center items-end gap-4">
345
+ <p-floatlabel class="w-full md:w-56">
346
+ <p-cascadeselect [(ngModel)]="value1" inputId="over_label" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-full" />
347
+ <label for="over_label">Over Label</label>
348
+ </p-floatlabel>
349
+ <p-floatlabel class="w-full md:w-56" variant="in">
350
+ <p-cascadeselect [(ngModel)]="value2" inputId="in_label" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-full" />
351
+ <label for="in_label">In Label</label>
352
+ </p-floatlabel>
353
+ <p-floatlabel class="w-full md:w-56" variant="on">
354
+ <p-cascadeselect [(ngModel)]="value3" inputId="on_label" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-full" />
355
+ <label for="on_label">On Label</label>
356
+ </p-floatlabel>
357
+ </div>
358
+ `,
359
+ standalone: true,
360
+ imports: [CascadeSelectModule, FloatLabelModule, FormsModule]
361
+ })
362
+ export class CascadeselectFloatlabelDemo implements OnInit {
363
+ value1: string | undefined;
364
+ value2: string | undefined;
365
+ value3: string | undefined;
366
+ countries: any[] | undefined;
367
+ selectedCity: any;
368
+
369
+ ngOnInit() {
370
+ this.countries = [
371
+ {
372
+ name: 'Australia',
373
+ code: 'AU',
374
+ states: [
375
+ {
376
+ name: 'New South Wales',
377
+ cities: [
378
+ { cname: 'Sydney', code: 'A-SY' },
379
+ { cname: 'Newcastle', code: 'A-NE' },
380
+ { cname: 'Wollongong', code: 'A-WO' }
381
+ ]
382
+ },
383
+ {
384
+ name: 'Queensland',
385
+ cities: [
386
+ { cname: 'Brisbane', code: 'A-BR' },
387
+ { cname: 'Townsville', code: 'A-TO' }
388
+ ]
389
+ }
390
+ ]
391
+ },
392
+ {
393
+ name: 'Canada',
394
+ code: 'CA',
395
+ states: [
396
+ {
397
+ name: 'Quebec',
398
+ cities: [
399
+ { cname: 'Montreal', code: 'C-MO' },
400
+ { cname: 'Quebec City', code: 'C-QU' }
401
+ ]
402
+ },
403
+ {
404
+ name: 'Ontario',
405
+ cities: [
406
+ { cname: 'Ottawa', code: 'C-OT' },
407
+ { cname: 'Toronto', code: 'C-TO' }
408
+ ]
409
+ }
410
+ ]
411
+ },
412
+ {
413
+ name: 'United States',
414
+ code: 'US',
415
+ states: [
416
+ {
417
+ name: 'California',
418
+ cities: [
419
+ { cname: 'Los Angeles', code: 'US-LA' },
420
+ { cname: 'San Diego', code: 'US-SD' },
421
+ { cname: 'San Francisco', code: 'US-SF' }
422
+ ]
423
+ },
424
+ {
425
+ name: 'Florida',
426
+ cities: [
427
+ { cname: 'Jacksonville', code: 'US-JA' },
428
+ { cname: 'Miami', code: 'US-MI' },
429
+ { cname: 'Tampa', code: 'US-TA' },
430
+ { cname: 'Orlando', code: 'US-OR' }
431
+ ]
432
+ },
433
+ {
434
+ name: 'Texas',
435
+ cities: [
436
+ { cname: 'Austin', code: 'US-AU' },
437
+ { cname: 'Dallas', code: 'US-DA' },
438
+ { cname: 'Houston', code: 'US-HO' }
439
+ ]
440
+ }
441
+ ]
442
+ }
443
+ ];
444
+ }
445
+ }
446
+ ```
447
+
448
+ ## Fluid
449
+
450
+ The fluid prop makes the component take up the full width of its container when set to true.
451
+
452
+ ```typescript
453
+ import { Component, OnInit } from '@angular/core';
454
+ import { FormsModule } from '@angular/forms';
455
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
456
+
457
+ @Component({
458
+ template: `
459
+ <div class="card">
460
+ <p-cascadeselect [(ngModel)]="selectedCity" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" placeholder="Select a City" fluid />
461
+ </div>
462
+ `,
463
+ standalone: true,
464
+ imports: [CascadeSelectModule, FormsModule]
465
+ })
466
+ export class CascadeselectFluidDemo implements OnInit {
467
+ countries: any[] | undefined;
468
+ selectedCity: any;
469
+
470
+ ngOnInit() {
471
+ this.countries = [
472
+ {
473
+ name: 'Australia',
474
+ code: 'AU',
475
+ states: [
476
+ {
477
+ name: 'New South Wales',
478
+ cities: [
479
+ { cname: 'Sydney', code: 'A-SY' },
480
+ { cname: 'Newcastle', code: 'A-NE' },
481
+ { cname: 'Wollongong', code: 'A-WO' }
482
+ ]
483
+ },
484
+ {
485
+ name: 'Queensland',
486
+ cities: [
487
+ { cname: 'Brisbane', code: 'A-BR' },
488
+ { cname: 'Townsville', code: 'A-TO' }
489
+ ]
490
+ }
491
+ ]
492
+ },
493
+ {
494
+ name: 'Canada',
495
+ code: 'CA',
496
+ states: [
497
+ {
498
+ name: 'Quebec',
499
+ cities: [
500
+ { cname: 'Montreal', code: 'C-MO' },
501
+ { cname: 'Quebec City', code: 'C-QU' }
502
+ ]
503
+ },
504
+ {
505
+ name: 'Ontario',
506
+ cities: [
507
+ { cname: 'Ottawa', code: 'C-OT' },
508
+ { cname: 'Toronto', code: 'C-TO' }
509
+ ]
510
+ }
511
+ ]
512
+ },
513
+ {
514
+ name: 'United States',
515
+ code: 'US',
516
+ states: [
517
+ {
518
+ name: 'California',
519
+ cities: [
520
+ { cname: 'Los Angeles', code: 'US-LA' },
521
+ { cname: 'San Diego', code: 'US-SD' },
522
+ { cname: 'San Francisco', code: 'US-SF' }
523
+ ]
524
+ },
525
+ {
526
+ name: 'Florida',
527
+ cities: [
528
+ { cname: 'Jacksonville', code: 'US-JA' },
529
+ { cname: 'Miami', code: 'US-MI' },
530
+ { cname: 'Tampa', code: 'US-TA' },
531
+ { cname: 'Orlando', code: 'US-OR' }
532
+ ]
533
+ },
534
+ {
535
+ name: 'Texas',
536
+ cities: [
537
+ { cname: 'Austin', code: 'US-AU' },
538
+ { cname: 'Dallas', code: 'US-DA' },
539
+ { cname: 'Houston', code: 'US-HO' }
540
+ ]
541
+ }
542
+ ]
543
+ }
544
+ ];
545
+ }
546
+ }
547
+ ```
548
+
549
+ ## iftalabel-doc
550
+
551
+ IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
552
+
553
+ ```typescript
554
+ import { Component, OnInit } from '@angular/core';
555
+ import { FormsModule } from '@angular/forms';
556
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
557
+ import { IftaLabelModule } from '@exhaustive-ui/core/iftalabel';
558
+
559
+ @Component({
560
+ template: `
561
+ <div class="card flex justify-center">
562
+ <p-iftalabel class="w-full md:w-56">
563
+ <p-cascadeselect [(ngModel)]="selectedCity" inputId="cs_city" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-full" />
564
+ <label for="cs_city">City</label>
565
+ </p-iftalabel>
566
+ </div>
567
+ `,
568
+ standalone: true,
569
+ imports: [CascadeSelectModule, IftaLabelModule, FormsModule]
570
+ })
571
+ export class CascadeselectIftalabelDemo implements OnInit {
572
+ countries: any[] | undefined;
573
+ selectedCity: any;
574
+
575
+ ngOnInit() {
576
+ this.countries = [
577
+ {
578
+ name: 'Australia',
579
+ code: 'AU',
580
+ states: [
581
+ {
582
+ name: 'New South Wales',
583
+ cities: [
584
+ { cname: 'Sydney', code: 'A-SY' },
585
+ { cname: 'Newcastle', code: 'A-NE' },
586
+ { cname: 'Wollongong', code: 'A-WO' }
587
+ ]
588
+ },
589
+ {
590
+ name: 'Queensland',
591
+ cities: [
592
+ { cname: 'Brisbane', code: 'A-BR' },
593
+ { cname: 'Townsville', code: 'A-TO' }
594
+ ]
595
+ }
596
+ ]
597
+ },
598
+ {
599
+ name: 'Canada',
600
+ code: 'CA',
601
+ states: [
602
+ {
603
+ name: 'Quebec',
604
+ cities: [
605
+ { cname: 'Montreal', code: 'C-MO' },
606
+ { cname: 'Quebec City', code: 'C-QU' }
607
+ ]
608
+ },
609
+ {
610
+ name: 'Ontario',
611
+ cities: [
612
+ { cname: 'Ottawa', code: 'C-OT' },
613
+ { cname: 'Toronto', code: 'C-TO' }
614
+ ]
615
+ }
616
+ ]
617
+ },
618
+ {
619
+ name: 'United States',
620
+ code: 'US',
621
+ states: [
622
+ {
623
+ name: 'California',
624
+ cities: [
625
+ { cname: 'Los Angeles', code: 'US-LA' },
626
+ { cname: 'San Diego', code: 'US-SD' },
627
+ { cname: 'San Francisco', code: 'US-SF' }
628
+ ]
629
+ },
630
+ {
631
+ name: 'Florida',
632
+ cities: [
633
+ { cname: 'Jacksonville', code: 'US-JA' },
634
+ { cname: 'Miami', code: 'US-MI' },
635
+ { cname: 'Tampa', code: 'US-TA' },
636
+ { cname: 'Orlando', code: 'US-OR' }
637
+ ]
638
+ },
639
+ {
640
+ name: 'Texas',
641
+ cities: [
642
+ { cname: 'Austin', code: 'US-AU' },
643
+ { cname: 'Dallas', code: 'US-DA' },
644
+ { cname: 'Houston', code: 'US-HO' }
645
+ ]
646
+ }
647
+ ]
648
+ }
649
+ ];
650
+ }
651
+ }
652
+ ```
653
+
654
+ ## Invalid
655
+
656
+ The invalid state is applied using the ⁠invalid property to indicate failed validation, which can be integrated with Angular Forms.
657
+
658
+ ```typescript
659
+ import { Component, OnInit } from '@angular/core';
660
+ import { FormsModule } from '@angular/forms';
661
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
662
+
663
+ @Component({
664
+ template: `
665
+ <div class="card flex flex-wrap justify-center gap-4">
666
+ <p-cascadeselect [(ngModel)]="selectedCity1" [invalid]="!selectedCity1" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-full sm:w-56" placeholder="Select a City" />
667
+ <p-cascadeselect
668
+ [(ngModel)]="selectedCity2"
669
+ [invalid]="!selectedCity2"
670
+ [options]="countries"
671
+ optionLabel="cname"
672
+ optionGroupLabel="name"
673
+ [optionGroupChildren]="['states', 'cities']"
674
+ class="w-full sm:w-56"
675
+ placeholder="Select a City"
676
+ variant="filled"
677
+ />
678
+ </div>
679
+ `,
680
+ standalone: true,
681
+ imports: [CascadeSelectModule, FormsModule]
682
+ })
683
+ export class CascadeselectInvalidDemo implements OnInit {
684
+ countries: any[] | undefined;
685
+ selectedCity1: any;
686
+ selectedCity2: any;
687
+
688
+ ngOnInit() {
689
+ this.countries = [
690
+ {
691
+ name: 'Australia',
692
+ code: 'AU',
693
+ states: [
694
+ {
695
+ name: 'New South Wales',
696
+ cities: [
697
+ { cname: 'Sydney', code: 'A-SY' },
698
+ { cname: 'Newcastle', code: 'A-NE' },
699
+ { cname: 'Wollongong', code: 'A-WO' }
700
+ ]
701
+ },
702
+ {
703
+ name: 'Queensland',
704
+ cities: [
705
+ { cname: 'Brisbane', code: 'A-BR' },
706
+ { cname: 'Townsville', code: 'A-TO' }
707
+ ]
708
+ }
709
+ ]
710
+ },
711
+ {
712
+ name: 'Canada',
713
+ code: 'CA',
714
+ states: [
715
+ {
716
+ name: 'Quebec',
717
+ cities: [
718
+ { cname: 'Montreal', code: 'C-MO' },
719
+ { cname: 'Quebec City', code: 'C-QU' }
720
+ ]
721
+ },
722
+ {
723
+ name: 'Ontario',
724
+ cities: [
725
+ { cname: 'Ottawa', code: 'C-OT' },
726
+ { cname: 'Toronto', code: 'C-TO' }
727
+ ]
728
+ }
729
+ ]
730
+ },
731
+ {
732
+ name: 'United States',
733
+ code: 'US',
734
+ states: [
735
+ {
736
+ name: 'California',
737
+ cities: [
738
+ { cname: 'Los Angeles', code: 'US-LA' },
739
+ { cname: 'San Diego', code: 'US-SD' },
740
+ { cname: 'San Francisco', code: 'US-SF' }
741
+ ]
742
+ },
743
+ {
744
+ name: 'Florida',
745
+ cities: [
746
+ { cname: 'Jacksonville', code: 'US-JA' },
747
+ { cname: 'Miami', code: 'US-MI' },
748
+ { cname: 'Tampa', code: 'US-TA' },
749
+ { cname: 'Orlando', code: 'US-OR' }
750
+ ]
751
+ },
752
+ {
753
+ name: 'Texas',
754
+ cities: [
755
+ { cname: 'Austin', code: 'US-AU' },
756
+ { cname: 'Dallas', code: 'US-DA' },
757
+ { cname: 'Houston', code: 'US-HO' }
758
+ ]
759
+ }
760
+ ]
761
+ }
762
+ ];
763
+ }
764
+ }
765
+ ```
766
+
767
+ ## Loading State
768
+
769
+ Loading state can be used loading property.
770
+
771
+ ```typescript
772
+ import { Component } from '@angular/core';
773
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
774
+
775
+ @Component({
776
+ template: `
777
+ <div class="card flex justify-center">
778
+ <p-cascadeselect [loading]="true" [style]="{ minWidth: '14rem' }" placeholder="Loading..." />
779
+ </div>
780
+ `,
781
+ standalone: true,
782
+ imports: [CascadeSelectModule]
783
+ })
784
+ export class CascadeselectLoadingDemo {}
785
+ ```
786
+
787
+ ## reactiveforms-doc
788
+
789
+ CascadeSelect can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.
790
+
791
+ ```typescript
792
+ import { Component, inject } from '@angular/core';
793
+ import { ReactiveFormsModule } from '@angular/forms';
794
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
795
+ import { MessageModule } from '@exhaustive-ui/core/message';
796
+ import { ToastModule } from '@exhaustive-ui/core/toast';
797
+ import { ButtonModule } from '@exhaustive-ui/core/button';
798
+ import { MessageService } from '@exhaustive-ui/core/api';
799
+
800
+ @Component({
801
+ template: `
802
+ <p-toast />
803
+ <div class="card flex justify-center">
804
+ <form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4">
805
+ <div class="flex flex-col gap-1">
806
+ <p-cascadeselect
807
+ formControlName="selectedCity"
808
+ [options]="countries"
809
+ optionLabel="cname"
810
+ optionGroupLabel="name"
811
+ [optionGroupChildren]="['states', 'cities']"
812
+ [style]="{ minWidth: '14rem' }"
813
+ placeholder="Select a City"
814
+ [invalid]="isInvalid('selectedCity')"
815
+ />
816
+ @if (isInvalid('selectedCity')) {
817
+ <p-message severity="error" size="small" variant="simple">City is required.</p-message>
818
+ }
819
+ </div>
820
+ <button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
821
+ </form>
822
+ </div>
823
+ `,
824
+ standalone: true,
825
+ imports: [CascadeSelectModule, MessageModule, ToastModule, ButtonModule, ReactiveFormsModule]
826
+ })
827
+ export class CascadeselectReactiveformsDemo {
828
+ countries: any[] | undefined;
829
+ formGroup: FormGroup | undefined;
830
+ messageService = inject(MessageService);
831
+ exampleForm: FormGroup | undefined;
832
+ formSubmitted: boolean = false;
833
+
834
+ constructor() {
835
+ this.countries = [
836
+ {
837
+ name: 'Australia',
838
+ code: 'AU',
839
+ states: [
840
+ {
841
+ name: 'New South Wales',
842
+ cities: [
843
+ { cname: 'Sydney', code: 'A-SY' },
844
+ { cname: 'Newcastle', code: 'A-NE' },
845
+ { cname: 'Wollongong', code: 'A-WO' }
846
+ ]
847
+ },
848
+ {
849
+ name: 'Queensland',
850
+ cities: [
851
+ { cname: 'Brisbane', code: 'A-BR' },
852
+ { cname: 'Townsville', code: 'A-TO' }
853
+ ]
854
+ }
855
+ ]
856
+ },
857
+ {
858
+ name: 'Canada',
859
+ code: 'CA',
860
+ states: [
861
+ {
862
+ name: 'Quebec',
863
+ cities: [
864
+ { cname: 'Montreal', code: 'C-MO' },
865
+ { cname: 'Quebec City', code: 'C-QU' }
866
+ ]
867
+ },
868
+ {
869
+ name: 'Ontario',
870
+ cities: [
871
+ { cname: 'Ottawa', code: 'C-OT' },
872
+ { cname: 'Toronto', code: 'C-TO' }
873
+ ]
874
+ }
875
+ ]
876
+ },
877
+ {
878
+ name: 'United States',
879
+ code: 'US',
880
+ states: [
881
+ {
882
+ name: 'California',
883
+ cities: [
884
+ { cname: 'Los Angeles', code: 'US-LA' },
885
+ { cname: 'San Diego', code: 'US-SD' },
886
+ { cname: 'San Francisco', code: 'US-SF' }
887
+ ]
888
+ },
889
+ {
890
+ name: 'Florida',
891
+ cities: [
892
+ { cname: 'Jacksonville', code: 'US-JA' },
893
+ { cname: 'Miami', code: 'US-MI' },
894
+ { cname: 'Tampa', code: 'US-TA' },
895
+ { cname: 'Orlando', code: 'US-OR' }
896
+ ]
897
+ },
898
+ {
899
+ name: 'Texas',
900
+ cities: [
901
+ { cname: 'Austin', code: 'US-AU' },
902
+ { cname: 'Dallas', code: 'US-DA' },
903
+ { cname: 'Houston', code: 'US-HO' }
904
+ ]
905
+ }
906
+ ]
907
+ }
908
+ ];
909
+ this.exampleForm = this.fb.group({
910
+ selectedCity: ['', Validators.required]
911
+ });
912
+ }
913
+
914
+ onSubmit() {
915
+ this.formSubmitted = true;
916
+ if (this.exampleForm.valid) {
917
+ this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form is submitted', life: 3000 });
918
+ this.exampleForm.reset();
919
+ this.formSubmitted = false;
920
+ }
921
+ }
922
+
923
+ isInvalid(controlName: string) {
924
+ const control = this.exampleForm.get(controlName);
925
+ return control?.invalid && this.formSubmitted;
926
+ }
927
+ }
928
+ ```
929
+
930
+ ## Sizes
931
+
932
+ CascadeSelect provides small and large sizes as alternatives to the base.
933
+
934
+ ```typescript
935
+ import { Component, OnInit } from '@angular/core';
936
+ import { FormsModule } from '@angular/forms';
937
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
938
+
939
+ @Component({
940
+ template: `
941
+ <div class="card flex flex-col items-center gap-4">
942
+ <p-cascadeselect [(ngModel)]="value1" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-56" size="small" placeholder="Small" />
943
+ <p-cascadeselect [(ngModel)]="value2" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-56" placeholder="Normal" />
944
+ <p-cascadeselect [(ngModel)]="value3" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" class="w-56" size="large" placeholder="Large" />
945
+ </div>
946
+ `,
947
+ standalone: true,
948
+ imports: [CascadeSelectModule, FormsModule]
949
+ })
950
+ export class CascadeselectSizesDemo implements OnInit {
951
+ countries: any[] | undefined;
952
+ value1: any;
953
+ value2: any;
954
+ value3: any;
955
+
956
+ ngOnInit() {
957
+ this.countries = [
958
+ {
959
+ name: 'Australia',
960
+ code: 'AU',
961
+ states: [
962
+ {
963
+ name: 'New South Wales',
964
+ cities: [
965
+ { cname: 'Sydney', code: 'A-SY' },
966
+ { cname: 'Newcastle', code: 'A-NE' },
967
+ { cname: 'Wollongong', code: 'A-WO' }
968
+ ]
969
+ },
970
+ {
971
+ name: 'Queensland',
972
+ cities: [
973
+ { cname: 'Brisbane', code: 'A-BR' },
974
+ { cname: 'Townsville', code: 'A-TO' }
975
+ ]
976
+ }
977
+ ]
978
+ },
979
+ {
980
+ name: 'Canada',
981
+ code: 'CA',
982
+ states: [
983
+ {
984
+ name: 'Quebec',
985
+ cities: [
986
+ { cname: 'Montreal', code: 'C-MO' },
987
+ { cname: 'Quebec City', code: 'C-QU' }
988
+ ]
989
+ },
990
+ {
991
+ name: 'Ontario',
992
+ cities: [
993
+ { cname: 'Ottawa', code: 'C-OT' },
994
+ { cname: 'Toronto', code: 'C-TO' }
995
+ ]
996
+ }
997
+ ]
998
+ },
999
+ {
1000
+ name: 'United States',
1001
+ code: 'US',
1002
+ states: [
1003
+ {
1004
+ name: 'California',
1005
+ cities: [
1006
+ { cname: 'Los Angeles', code: 'US-LA' },
1007
+ { cname: 'San Diego', code: 'US-SD' },
1008
+ { cname: 'San Francisco', code: 'US-SF' }
1009
+ ]
1010
+ },
1011
+ {
1012
+ name: 'Florida',
1013
+ cities: [
1014
+ { cname: 'Jacksonville', code: 'US-JA' },
1015
+ { cname: 'Miami', code: 'US-MI' },
1016
+ { cname: 'Tampa', code: 'US-TA' },
1017
+ { cname: 'Orlando', code: 'US-OR' }
1018
+ ]
1019
+ },
1020
+ {
1021
+ name: 'Texas',
1022
+ cities: [
1023
+ { cname: 'Austin', code: 'US-AU' },
1024
+ { cname: 'Dallas', code: 'US-DA' },
1025
+ { cname: 'Houston', code: 'US-HO' }
1026
+ ]
1027
+ }
1028
+ ]
1029
+ }
1030
+ ];
1031
+ }
1032
+ }
1033
+ ```
1034
+
1035
+ ## Template
1036
+
1037
+ Label of an option is used as the display text of an item by default, for custom content support define an option template that gets the option instance as a parameter. In addition value , dropdownicon , loadingicon , and optiongroupicon slots are provided for further customization.
1038
+
1039
+ ```typescript
1040
+ import { Component, OnInit } from '@angular/core';
1041
+ import { FormsModule } from '@angular/forms';
1042
+ import { ButtonModule } from '@exhaustive-ui/core/button';
1043
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
1044
+
1045
+ @Component({
1046
+ template: `
1047
+ <div class="card flex justify-center">
1048
+ <p-cascadeselect [(ngModel)]="selectedCity" [options]="countries" optionLabel="cname" optionGroupLabel="name" [optionGroupChildren]="['states', 'cities']" [style]="{ minWidth: '14rem' }" placeholder="Select a City">
1049
+ <ng-template #option let-option>
1050
+ <div class="flex items-center">
1051
+ <img *ngIf="option.states" src="https://exhaustive-ui.e-xiste.com/demo/flag/flag_placeholder.png" [class]="'mr-2 flag flag-' + option.code.toLowerCase()" style="width: 18px" />
1052
+ <i class="pi pi-compass mr-2" *ngIf="option.cities"></i>
1053
+ <i class="pi pi-map-marker mr-2" *ngIf="option.cname"></i>
1054
+ <span>{{ option.cname || option.name }}</span>
1055
+ </div>
1056
+ </ng-template>
1057
+ <ng-template #triggericon>
1058
+ <i class="pi pi-map"></i>
1059
+ </ng-template>
1060
+ <ng-template #header>
1061
+ <div class="font-medium px-3 py-2">Available Countries</div>
1062
+ </ng-template>
1063
+ <ng-template #footer>
1064
+ <div class="px-3 py-1">
1065
+ <p-button label="Add New" fluid severity="secondary" text size="small" icon="pi pi-plus" />
1066
+ </div>
1067
+ </ng-template>
1068
+ </p-cascadeselect>
1069
+ </div>
1070
+ `,
1071
+ standalone: true,
1072
+ imports: [ButtonModule, CascadeSelectModule, FormsModule]
1073
+ })
1074
+ export class CascadeselectTemplateDemo implements OnInit {
1075
+ countries: any[] | undefined;
1076
+ selectedCity: any;
1077
+
1078
+ ngOnInit() {
1079
+ this.countries = [
1080
+ {
1081
+ name: 'Australia',
1082
+ code: 'AU',
1083
+ states: [
1084
+ {
1085
+ name: 'New South Wales',
1086
+ cities: [
1087
+ { cname: 'Sydney', code: 'A-SY' },
1088
+ { cname: 'Newcastle', code: 'A-NE' },
1089
+ { cname: 'Wollongong', code: 'A-WO' }
1090
+ ]
1091
+ },
1092
+ {
1093
+ name: 'Queensland',
1094
+ cities: [
1095
+ { cname: 'Brisbane', code: 'A-BR' },
1096
+ { cname: 'Townsville', code: 'A-TO' }
1097
+ ]
1098
+ }
1099
+ ]
1100
+ },
1101
+ {
1102
+ name: 'Canada',
1103
+ code: 'CA',
1104
+ states: [
1105
+ {
1106
+ name: 'Quebec',
1107
+ cities: [
1108
+ { cname: 'Montreal', code: 'C-MO' },
1109
+ { cname: 'Quebec City', code: 'C-QU' }
1110
+ ]
1111
+ },
1112
+ {
1113
+ name: 'Ontario',
1114
+ cities: [
1115
+ { cname: 'Ottawa', code: 'C-OT' },
1116
+ { cname: 'Toronto', code: 'C-TO' }
1117
+ ]
1118
+ }
1119
+ ]
1120
+ },
1121
+ {
1122
+ name: 'United States',
1123
+ code: 'US',
1124
+ states: [
1125
+ {
1126
+ name: 'California',
1127
+ cities: [
1128
+ { cname: 'Los Angeles', code: 'US-LA' },
1129
+ { cname: 'San Diego', code: 'US-SD' },
1130
+ { cname: 'San Francisco', code: 'US-SF' }
1131
+ ]
1132
+ },
1133
+ {
1134
+ name: 'Florida',
1135
+ cities: [
1136
+ { cname: 'Jacksonville', code: 'US-JA' },
1137
+ { cname: 'Miami', code: 'US-MI' },
1138
+ { cname: 'Tampa', code: 'US-TA' },
1139
+ { cname: 'Orlando', code: 'US-OR' }
1140
+ ]
1141
+ },
1142
+ {
1143
+ name: 'Texas',
1144
+ cities: [
1145
+ { cname: 'Austin', code: 'US-AU' },
1146
+ { cname: 'Dallas', code: 'US-DA' },
1147
+ { cname: 'Houston', code: 'US-HO' }
1148
+ ]
1149
+ }
1150
+ ]
1151
+ }
1152
+ ];
1153
+ }
1154
+ }
1155
+ ```
1156
+
1157
+ ## templatedrivenforms-doc
1158
+
1159
+ ```typescript
1160
+ import { Component, inject } from '@angular/core';
1161
+ import { FormsModule } from '@angular/forms';
1162
+ import { CascadeSelectModule } from '@exhaustive-ui/core/cascadeselect';
1163
+ import { MessageModule } from '@exhaustive-ui/core/message';
1164
+ import { ToastModule } from '@exhaustive-ui/core/toast';
1165
+ import { ButtonModule } from '@exhaustive-ui/core/button';
1166
+ import { MessageService } from '@exhaustive-ui/core/api';
1167
+
1168
+ @Component({
1169
+ template: `
1170
+ <p-toast />
1171
+ <div class="card flex justify-center">
1172
+ <form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex justify-center flex-col gap-4">
1173
+ <div class="flex flex-col gap-1">
1174
+ <p-cascadeselect
1175
+ #city="ngModel"
1176
+ [(ngModel)]="selectedCity"
1177
+ [options]="countries"
1178
+ [invalid]="city.invalid && (city.touched || exampleForm.submitted)"
1179
+ name="city"
1180
+ optionLabel="cname"
1181
+ optionGroupLabel="name"
1182
+ [optionGroupChildren]="['states', 'cities']"
1183
+ [style]="{ minWidth: '14rem' }"
1184
+ placeholder="Select a City"
1185
+ required
1186
+ />
1187
+ @if (city.invalid && (city.touched || exampleForm.submitted)) {
1188
+ <p-message severity="error" size="small" variant="simple">City is required.</p-message>
1189
+ }
1190
+ </div>
1191
+ <button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
1192
+ </form>
1193
+ </div>
1194
+ `,
1195
+ standalone: true,
1196
+ imports: [CascadeSelectModule, MessageModule, ToastModule, ButtonModule, FormsModule]
1197
+ })
1198
+ export class CascadeselectTemplatedrivenformsDemo {
1199
+ messageService = inject(MessageService);
1200
+ countries: any[] | undefined;
1201
+ selectedCity: any = null;
1202
+
1203
+ constructor() {
1204
+ this.countries = [
1205
+ {
1206
+ name: 'Australia',
1207
+ code: 'AU',
1208
+ states: [
1209
+ {
1210
+ name: 'New South Wales',
1211
+ cities: [
1212
+ { cname: 'Sydney', code: 'A-SY' },
1213
+ { cname: 'Newcastle', code: 'A-NE' },
1214
+ { cname: 'Wollongong', code: 'A-WO' }
1215
+ ]
1216
+ },
1217
+ {
1218
+ name: 'Queensland',
1219
+ cities: [
1220
+ { cname: 'Brisbane', code: 'A-BR' },
1221
+ { cname: 'Townsville', code: 'A-TO' }
1222
+ ]
1223
+ }
1224
+ ]
1225
+ },
1226
+ {
1227
+ name: 'Canada',
1228
+ code: 'CA',
1229
+ states: [
1230
+ {
1231
+ name: 'Quebec',
1232
+ cities: [
1233
+ { cname: 'Montreal', code: 'C-MO' },
1234
+ { cname: 'Quebec City', code: 'C-QU' }
1235
+ ]
1236
+ },
1237
+ {
1238
+ name: 'Ontario',
1239
+ cities: [
1240
+ { cname: 'Ottawa', code: 'C-OT' },
1241
+ { cname: 'Toronto', code: 'C-TO' }
1242
+ ]
1243
+ }
1244
+ ]
1245
+ },
1246
+ {
1247
+ name: 'United States',
1248
+ code: 'US',
1249
+ states: [
1250
+ {
1251
+ name: 'California',
1252
+ cities: [
1253
+ { cname: 'Los Angeles', code: 'US-LA' },
1254
+ { cname: 'San Diego', code: 'US-SD' },
1255
+ { cname: 'San Francisco', code: 'US-SF' }
1256
+ ]
1257
+ },
1258
+ {
1259
+ name: 'Florida',
1260
+ cities: [
1261
+ { cname: 'Jacksonville', code: 'US-JA' },
1262
+ { cname: 'Miami', code: 'US-MI' },
1263
+ { cname: 'Tampa', code: 'US-TA' },
1264
+ { cname: 'Orlando', code: 'US-OR' }
1265
+ ]
1266
+ },
1267
+ {
1268
+ name: 'Texas',
1269
+ cities: [
1270
+ { cname: 'Austin', code: 'US-AU' },
1271
+ { cname: 'Dallas', code: 'US-DA' },
1272
+ { cname: 'Houston', code: 'US-HO' }
1273
+ ]
1274
+ }
1275
+ ]
1276
+ }
1277
+ ];
1278
+ }
1279
+
1280
+ onSubmit(form: any) {
1281
+ if (form.valid) {
1282
+ this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
1283
+ form.resetForm();
1284
+ }
1285
+ }
1286
+ }
1287
+ ```
1288
+
1289
+ ## Pass Through Options
1290
+
1291
+ | Name | Type | Description |
1292
+ |------|------|-------------|
1293
+ | root | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the root's DOM element. |
1294
+ | hiddenInputWrapper | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the hidden input wrapper's DOM element. |
1295
+ | hiddenInput | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the hidden input's DOM element. |
1296
+ | label | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the label's DOM element. |
1297
+ | dropdown | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the dropdown's DOM element. |
1298
+ | loadingIcon | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the loading icon's DOM element. |
1299
+ | dropdownIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the dropdown icon's DOM element. |
1300
+ | clearIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the clear icon's DOM element. |
1301
+ | overlay | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the overlay's DOM element. |
1302
+ | listContainer | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the list container's DOM element. |
1303
+ | list | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the list's DOM element. |
1304
+ | optionList | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the option list's DOM element. |
1305
+ | option | PassThroughOption<HTMLLIElement, I> | Used to pass attributes to the option's DOM element. |
1306
+ | optionContent | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the option content's DOM element. |
1307
+ | optionText | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the option text's DOM element. |
1308
+ | groupIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the group icon's DOM element. |
1309
+
1310
+ ## Theming
1311
+
1312
+ ### CSS Classes
1313
+
1314
+ | Class | Description |
1315
+ |-------|-------------|
1316
+ | p-cascadeselect | Class name of the root element |
1317
+ | p-cascadeselect-label | Class name of the label element |
1318
+ | p-cascadeselect-dropdown | Class name of the dropdown element |
1319
+ | p-cascadeselect-loading-icon | Class name of the loading icon element |
1320
+ | p-cascadeselect-clear-icon | Class name of the dropdown icon element |
1321
+ | p-cascadeselect-dropdown-icon | Class name of the dropdown icon element |
1322
+ | p-cascadeselect-overlay | Class name of the overlay element |
1323
+ | p-cascadeselect-list-container | Class name of the list container element |
1324
+ | p-cascadeselect-list | Class name of the list element |
1325
+ | p-cascadeselect-item | Class name of the item element |
1326
+ | p-cascadeselect-item-content | Class name of the item content element |
1327
+ | p-cascadeselect-item-text | Class name of the item text element |
1328
+ | p-cascadeselect-group-icon | Class name of the group icon element |
1329
+ | p-cascadeselect-item-list | Class name of the item list element |
1330
+
1331
+ ### Design Tokens
1332
+
1333
+ | Token | CSS Variable | Description |
1334
+ |-------|--------------|-------------|
1335
+ | cascadeselect.background | --p-cascadeselect-background | Background of root |
1336
+ | cascadeselect.disabled.background | --p-cascadeselect-disabled-background | Disabled background of root |
1337
+ | cascadeselect.filled.background | --p-cascadeselect-filled-background | Filled background of root |
1338
+ | cascadeselect.filled.hover.background | --p-cascadeselect-filled-hover-background | Filled hover background of root |
1339
+ | cascadeselect.filled.focus.background | --p-cascadeselect-filled-focus-background | Filled focus background of root |
1340
+ | cascadeselect.border.color | --p-cascadeselect-border-color | Border color of root |
1341
+ | cascadeselect.hover.border.color | --p-cascadeselect-hover-border-color | Hover border color of root |
1342
+ | cascadeselect.focus.border.color | --p-cascadeselect-focus-border-color | Focus border color of root |
1343
+ | cascadeselect.invalid.border.color | --p-cascadeselect-invalid-border-color | Invalid border color of root |
1344
+ | cascadeselect.color | --p-cascadeselect-color | Color of root |
1345
+ | cascadeselect.disabled.color | --p-cascadeselect-disabled-color | Disabled color of root |
1346
+ | cascadeselect.placeholder.color | --p-cascadeselect-placeholder-color | Placeholder color of root |
1347
+ | cascadeselect.invalid.placeholder.color | --p-cascadeselect-invalid-placeholder-color | Invalid placeholder color of root |
1348
+ | cascadeselect.shadow | --p-cascadeselect-shadow | Shadow of root |
1349
+ | cascadeselect.padding.x | --p-cascadeselect-padding-x | Padding x of root |
1350
+ | cascadeselect.padding.y | --p-cascadeselect-padding-y | Padding y of root |
1351
+ | cascadeselect.border.radius | --p-cascadeselect-border-radius | Border radius of root |
1352
+ | cascadeselect.focus.ring.width | --p-cascadeselect-focus-ring-width | Focus ring width of root |
1353
+ | cascadeselect.focus.ring.style | --p-cascadeselect-focus-ring-style | Focus ring style of root |
1354
+ | cascadeselect.focus.ring.color | --p-cascadeselect-focus-ring-color | Focus ring color of root |
1355
+ | cascadeselect.focus.ring.offset | --p-cascadeselect-focus-ring-offset | Focus ring offset of root |
1356
+ | cascadeselect.focus.ring.shadow | --p-cascadeselect-focus-ring-shadow | Focus ring shadow of root |
1357
+ | cascadeselect.transition.duration | --p-cascadeselect-transition-duration | Transition duration of root |
1358
+ | cascadeselect.sm.font.size | --p-cascadeselect-sm-font-size | Sm font size of root |
1359
+ | cascadeselect.sm.padding.x | --p-cascadeselect-sm-padding-x | Sm padding x of root |
1360
+ | cascadeselect.sm.padding.y | --p-cascadeselect-sm-padding-y | Sm padding y of root |
1361
+ | cascadeselect.lg.font.size | --p-cascadeselect-lg-font-size | Lg font size of root |
1362
+ | cascadeselect.lg.padding.x | --p-cascadeselect-lg-padding-x | Lg padding x of root |
1363
+ | cascadeselect.lg.padding.y | --p-cascadeselect-lg-padding-y | Lg padding y of root |
1364
+ | cascadeselect.dropdown.width | --p-cascadeselect-dropdown-width | Width of dropdown |
1365
+ | cascadeselect.dropdown.color | --p-cascadeselect-dropdown-color | Color of dropdown |
1366
+ | cascadeselect.overlay.background | --p-cascadeselect-overlay-background | Background of overlay |
1367
+ | cascadeselect.overlay.border.color | --p-cascadeselect-overlay-border-color | Border color of overlay |
1368
+ | cascadeselect.overlay.border.radius | --p-cascadeselect-overlay-border-radius | Border radius of overlay |
1369
+ | cascadeselect.overlay.color | --p-cascadeselect-overlay-color | Color of overlay |
1370
+ | cascadeselect.overlay.shadow | --p-cascadeselect-overlay-shadow | Shadow of overlay |
1371
+ | cascadeselect.list.padding | --p-cascadeselect-list-padding | Padding of list |
1372
+ | cascadeselect.list.gap | --p-cascadeselect-list-gap | Gap of list |
1373
+ | cascadeselect.list.mobile.indent | --p-cascadeselect-list-mobile-indent | Mobile indent of list |
1374
+ | cascadeselect.option.focus.background | --p-cascadeselect-option-focus-background | Focus background of option |
1375
+ | cascadeselect.option.selected.background | --p-cascadeselect-option-selected-background | Selected background of option |
1376
+ | cascadeselect.option.selected.focus.background | --p-cascadeselect-option-selected-focus-background | Selected focus background of option |
1377
+ | cascadeselect.option.color | --p-cascadeselect-option-color | Color of option |
1378
+ | cascadeselect.option.focus.color | --p-cascadeselect-option-focus-color | Focus color of option |
1379
+ | cascadeselect.option.selected.color | --p-cascadeselect-option-selected-color | Selected color of option |
1380
+ | cascadeselect.option.selected.focus.color | --p-cascadeselect-option-selected-focus-color | Selected focus color of option |
1381
+ | cascadeselect.option.padding | --p-cascadeselect-option-padding | Padding of option |
1382
+ | cascadeselect.option.border.radius | --p-cascadeselect-option-border-radius | Border radius of option |
1383
+ | cascadeselect.option.icon.color | --p-cascadeselect-option-icon-color | Icon color of option |
1384
+ | cascadeselect.option.icon.focus.color | --p-cascadeselect-option-icon-focus-color | Icon focus color of option |
1385
+ | cascadeselect.option.icon.size | --p-cascadeselect-option-icon-size | Icon size of option |
1386
+ | cascadeselect.clear.icon.color | --p-cascadeselect-clear-icon-color | Color of clear icon |
1387
+