@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.
- package/LICENSE +23 -0
- package/README.md +167 -2
- package/data/components/accordion.md +421 -0
- package/data/components/animateonscroll.md +163 -0
- package/data/components/autocomplete.md +1077 -0
- package/data/components/autofocus.md +38 -0
- package/data/components/avatar.md +417 -0
- package/data/components/badge.md +234 -0
- package/data/components/blockui.md +108 -0
- package/data/components/breadcrumb.md +178 -0
- package/data/components/button.md +774 -0
- package/data/components/card.md +138 -0
- package/data/components/carousel.md +440 -0
- package/data/components/cascadeselect.md +1387 -0
- package/data/components/chart.md +1178 -0
- package/data/components/checkbox.md +529 -0
- package/data/components/chip.md +180 -0
- package/data/components/colorpicker.md +301 -0
- package/data/components/confirmdialog.md +287 -0
- package/data/components/confirmpopup.md +417 -0
- package/data/components/contextmenu.md +491 -0
- package/data/components/dataview.md +600 -0
- package/data/components/datepicker.md +1262 -0
- package/data/components/dialog.md +622 -0
- package/data/components/divider.md +250 -0
- package/data/components/dock.md +500 -0
- package/data/components/dragdrop.md +285 -0
- package/data/components/drawer.md +510 -0
- package/data/components/dynamicdialog.md +109 -0
- package/data/components/editor.md +291 -0
- package/data/components/fieldset.md +182 -0
- package/data/components/fileupload.md +430 -0
- package/data/components/floatlabel.md +155 -0
- package/data/components/fluid.md +72 -0
- package/data/components/focustrap.md +65 -0
- package/data/components/galleria.md +627 -0
- package/data/components/iconfield.md +246 -0
- package/data/components/iftalabel.md +105 -0
- package/data/components/imagecompare.md +97 -0
- package/data/components/inplace.md +233 -0
- package/data/components/inputgroup.md +306 -0
- package/data/components/inputmask.md +518 -0
- package/data/components/inputnumber.md +675 -0
- package/data/components/inputotp.md +336 -0
- package/data/components/inputtext.md +488 -0
- package/data/components/keyfilter.md +85 -0
- package/data/components/knob.md +462 -0
- package/data/components/listbox.md +798 -0
- package/data/components/llms.md +28 -0
- package/data/components/megamenu.md +587 -0
- package/data/components/menu.md +483 -0
- package/data/components/menubar.md +462 -0
- package/data/components/message.md +449 -0
- package/data/components/metergroup.md +241 -0
- package/data/components/multiselect.md +1047 -0
- package/data/components/orderlist.md +342 -0
- package/data/components/organizationchart.md +197 -0
- package/data/components/overlay.md +217 -0
- package/data/components/paginator.md +314 -0
- package/data/components/panel.md +214 -0
- package/data/components/panelmenu.md +699 -0
- package/data/components/password.md +570 -0
- package/data/components/picklist.md +420 -0
- package/data/components/popover.md +378 -0
- package/data/components/progressbar.md +181 -0
- package/data/components/progressspinner.md +91 -0
- package/data/components/radiobutton.md +377 -0
- package/data/components/rating.md +312 -0
- package/data/components/ripple.md +89 -0
- package/data/components/scroller.md +122 -0
- package/data/components/scrollpanel.md +149 -0
- package/data/components/scrolltop.md +105 -0
- package/data/components/select.md +1206 -0
- package/data/components/selectbutton.md +356 -0
- package/data/components/skeleton.md +242 -0
- package/data/components/slider.md +337 -0
- package/data/components/speeddial.md +589 -0
- package/data/components/splitbutton.md +945 -0
- package/data/components/splitter.md +196 -0
- package/data/components/stepper.md +411 -0
- package/data/components/styleclass.md +126 -0
- package/data/components/table.md +4557 -0
- package/data/components/tabs.md +467 -0
- package/data/components/tag.md +200 -0
- package/data/components/terminal.md +118 -0
- package/data/components/textarea.md +416 -0
- package/data/components/tieredmenu.md +578 -0
- package/data/components/timeline.md +310 -0
- package/data/components/toast.md +596 -0
- package/data/components/togglebutton.md +356 -0
- package/data/components/toggleswitch.md +285 -0
- package/data/components/toolbar.md +182 -0
- package/data/components/tooltip.md +211 -0
- package/data/components/tree.md +746 -0
- package/data/components/treeselect.md +912 -0
- package/data/components/treetable.md +2814 -0
- package/data/components.json +43751 -0
- package/data/llms-full.txt +47433 -0
- package/data/llms.txt +121 -0
- package/data/manifest.json +46513 -0
- package/data/pages/accessibility.md +28 -0
- package/data/pages/animations.md +28 -0
- package/data/pages/configuration.md +210 -0
- package/data/pages/contribution.md +20 -0
- package/data/pages/customicons.md +20 -0
- package/data/pages/faq.md +20 -0
- package/data/pages/icons.md +66 -0
- package/data/pages/installation.md +71 -0
- package/data/pages/llms.md +61 -0
- package/data/pages/passthrough.md +32 -0
- package/data/pages/philosophy.md +28 -0
- package/data/pages/primeflex.md +20 -0
- package/data/pages/rtl.md +12 -0
- package/data/pages/styled.md +132 -0
- package/data/pages/tailwind.md +40 -0
- package/data/pages/unstyled.md +39 -0
- package/data/snapshot.json +9 -0
- package/dist/index.d.mts +448 -0
- package/dist/index.mjs +2501 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -3
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Angular RadioButton Component
|
|
2
|
+
|
|
3
|
+
RadioButton is an extension to standard radio button element with theming.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Screen Reader RadioButton component uses a hidden native radio button element internally that is only visible to screen readers. Value to describe the component can either be provided via label tag combined with inputId prop or using ariaLabelledBy , ariaLabel props.
|
|
8
|
+
|
|
9
|
+
## Disabled
|
|
10
|
+
|
|
11
|
+
When disabled is present, the element cannot be edited and focused.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component } from '@angular/core';
|
|
15
|
+
import { FormsModule } from '@angular/forms';
|
|
16
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
template: `
|
|
20
|
+
<div class="card flex justify-center gap-2">
|
|
21
|
+
<p-radiobutton [(ngModel)]="value" [value]="1" [disabled]="true" />
|
|
22
|
+
<p-radiobutton [(ngModel)]="value" [value]="2" [disabled]="true" />
|
|
23
|
+
</div>
|
|
24
|
+
`,
|
|
25
|
+
standalone: true,
|
|
26
|
+
imports: [RadioButtonModule, FormsModule]
|
|
27
|
+
})
|
|
28
|
+
export class RadiobuttonDisabledDemo {
|
|
29
|
+
value: number = 2;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Dynamic
|
|
34
|
+
|
|
35
|
+
RadioButtons can be generated using a list of values.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Component, OnInit } from '@angular/core';
|
|
39
|
+
import { FormsModule } from '@angular/forms';
|
|
40
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
41
|
+
|
|
42
|
+
@Component({
|
|
43
|
+
template: `
|
|
44
|
+
<div class="card flex justify-center">
|
|
45
|
+
<div class="flex flex-col gap-4">
|
|
46
|
+
<div *ngFor="let category of categories" class="field-checkbox">
|
|
47
|
+
<p-radiobutton [inputId]="category.key" name="category" [value]="category" [(ngModel)]="selectedCategory" />
|
|
48
|
+
<label [for]="category.key" class="ml-2">{{ category.name }}</label>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
`,
|
|
53
|
+
standalone: true,
|
|
54
|
+
imports: [RadioButtonModule, FormsModule]
|
|
55
|
+
})
|
|
56
|
+
export class RadiobuttonDynamicDemo implements OnInit {
|
|
57
|
+
selectedCategory: any = null;
|
|
58
|
+
categories: any[];
|
|
59
|
+
|
|
60
|
+
ngOnInit() {
|
|
61
|
+
this.selectedCategory = this.categories[1];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Filled
|
|
67
|
+
|
|
68
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { Component } from '@angular/core';
|
|
72
|
+
import { FormsModule } from '@angular/forms';
|
|
73
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
74
|
+
|
|
75
|
+
@Component({
|
|
76
|
+
template: `
|
|
77
|
+
<div class="card flex justify-center">
|
|
78
|
+
<p-radiobutton [(ngModel)]="checked" variant="filled" />
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
standalone: true,
|
|
82
|
+
imports: [RadioButtonModule, FormsModule]
|
|
83
|
+
})
|
|
84
|
+
export class RadiobuttonFilledDemo {
|
|
85
|
+
checked: boolean = false;
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Group
|
|
90
|
+
|
|
91
|
+
RadioButton is used as a controlled input with value and ngModel properties.
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { Component } from '@angular/core';
|
|
95
|
+
import { FormsModule } from '@angular/forms';
|
|
96
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
97
|
+
|
|
98
|
+
@Component({
|
|
99
|
+
template: `
|
|
100
|
+
<div class="card flex justify-center">
|
|
101
|
+
<div class="flex flex-wrap gap-4">
|
|
102
|
+
<div class="flex items-center">
|
|
103
|
+
<p-radiobutton name="pizza" value="Cheese" [(ngModel)]="ingredient" inputId="ingredient1" />
|
|
104
|
+
<label for="ingredient1" class="ml-2">Cheese</label>
|
|
105
|
+
</div>
|
|
106
|
+
<div class="flex items-center">
|
|
107
|
+
<p-radiobutton name="pizza" value="Mushroom" [(ngModel)]="ingredient" inputId="ingredient2" />
|
|
108
|
+
<label for="ingredient2" class="ml-2">Mushroom</label>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="flex items-center">
|
|
111
|
+
<p-radiobutton name="pizza" value="Pepper" [(ngModel)]="ingredient" inputId="ingredient3" />
|
|
112
|
+
<label for="ingredient3" class="ml-2">Pepper</label>
|
|
113
|
+
</div>
|
|
114
|
+
<div class="flex items-center">
|
|
115
|
+
<p-radiobutton name="pizza" value="Onion" [(ngModel)]="ingredient" inputId="ingredient4" />
|
|
116
|
+
<label for="ingredient4" class="ml-2">Onion</label>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
`,
|
|
121
|
+
standalone: true,
|
|
122
|
+
imports: [RadioButtonModule, FormsModule]
|
|
123
|
+
})
|
|
124
|
+
export class RadiobuttonGroupDemo {
|
|
125
|
+
ingredient!: string;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Invalid
|
|
130
|
+
|
|
131
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with Angular Forms.
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { Component } from '@angular/core';
|
|
135
|
+
import { FormsModule } from '@angular/forms';
|
|
136
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
template: `
|
|
140
|
+
<div class="card flex justify-center">
|
|
141
|
+
<p-radiobutton [(ngModel)]="value" [invalid]="!value" />
|
|
142
|
+
</div>
|
|
143
|
+
`,
|
|
144
|
+
standalone: true,
|
|
145
|
+
imports: [RadioButtonModule, FormsModule]
|
|
146
|
+
})
|
|
147
|
+
export class RadiobuttonInvalidDemo {
|
|
148
|
+
value: boolean = false;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## reactiveforms-doc
|
|
153
|
+
|
|
154
|
+
RadioButton can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { Component, inject } from '@angular/core';
|
|
158
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
159
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
160
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
161
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
162
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
163
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
164
|
+
|
|
165
|
+
@Component({
|
|
166
|
+
template: `
|
|
167
|
+
<p-toast />
|
|
168
|
+
<div class="card flex justify-center">
|
|
169
|
+
<form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4">
|
|
170
|
+
<div class="flex flex-wrap gap-4">
|
|
171
|
+
@for (category of categories; track category.key) {
|
|
172
|
+
<div class="flex items-center gap-2">
|
|
173
|
+
<p-radiobutton formControlName="selectedCategory" name="selectedCategory" [inputId]="category.key" [value]="category" [invalid]="isInvalid('selectedCategory')" />
|
|
174
|
+
<label [for]="category.key"> {{ category.name }} </label>
|
|
175
|
+
</div>
|
|
176
|
+
}
|
|
177
|
+
</div>
|
|
178
|
+
@if (isInvalid('selectedCategory')) {
|
|
179
|
+
<p-message severity="error" size="small" variant="simple"> At least one ingredient must be selected. </p-message>
|
|
180
|
+
}
|
|
181
|
+
<button pButton severity="secondary" type="submit">
|
|
182
|
+
<span pButtonLabel>Submit</span>
|
|
183
|
+
</button>
|
|
184
|
+
</form>
|
|
185
|
+
</div>
|
|
186
|
+
`,
|
|
187
|
+
standalone: true,
|
|
188
|
+
imports: [MessageModule, RadioButtonModule, ToastModule, ButtonModule, ReactiveFormsModule],
|
|
189
|
+
providers: [MessageService]
|
|
190
|
+
})
|
|
191
|
+
export class RadiobuttonReactiveformsDemo {
|
|
192
|
+
private messageService = inject(MessageService);
|
|
193
|
+
messageService = inject(MessageService);
|
|
194
|
+
formSubmitted: boolean = false;
|
|
195
|
+
exampleForm: FormGroup;
|
|
196
|
+
categories: any[];
|
|
197
|
+
|
|
198
|
+
constructor() {
|
|
199
|
+
this.exampleForm = this.fb.group({
|
|
200
|
+
selectedCategory: ['', Validators.required]
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
isInvalid(controlName: string) {
|
|
205
|
+
const control = this.exampleForm.get(controlName);
|
|
206
|
+
return control?.invalid && this.formSubmitted;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
onSubmit() {
|
|
210
|
+
this.formSubmitted = true;
|
|
211
|
+
|
|
212
|
+
if (this.exampleForm.valid) {
|
|
213
|
+
this.messageService.add({
|
|
214
|
+
severity: 'success',
|
|
215
|
+
summary: 'Success',
|
|
216
|
+
detail: 'Form is submitted',
|
|
217
|
+
life: 3000
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
this.exampleForm.reset();
|
|
221
|
+
|
|
222
|
+
this.formSubmitted = false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Sizes
|
|
229
|
+
|
|
230
|
+
RadioButton provides small and large sizes as alternatives to the base.
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import { Component } from '@angular/core';
|
|
234
|
+
import { FormsModule } from '@angular/forms';
|
|
235
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
236
|
+
|
|
237
|
+
@Component({
|
|
238
|
+
template: `
|
|
239
|
+
<div class="card flex justify-center">
|
|
240
|
+
<div class="flex flex-wrap gap-4">
|
|
241
|
+
<div class="flex items-center gap-2">
|
|
242
|
+
<p-radiobutton [(ngModel)]="size" inputId="size_small" name="size" value="Small" size="small" />
|
|
243
|
+
<label for="size_small" class="text-sm">Small</label>
|
|
244
|
+
</div>
|
|
245
|
+
<div class="flex items-center gap-2">
|
|
246
|
+
<p-radiobutton [(ngModel)]="size" inputId="size_normal" name="size" value="Normal" />
|
|
247
|
+
<label for="size_normal">Normal</label>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="flex items-center gap-2">
|
|
250
|
+
<p-radiobutton [(ngModel)]="size" inputId="size_large" name="size" value="Large" size="large" />
|
|
251
|
+
<label for="size_large" class="text-lg">Large</label>
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
`,
|
|
256
|
+
standalone: true,
|
|
257
|
+
imports: [RadioButtonModule, FormsModule]
|
|
258
|
+
})
|
|
259
|
+
export class RadiobuttonSizesDemo {
|
|
260
|
+
size: any = false;
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## templatedrivenforms-doc
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
import { Component, inject } from '@angular/core';
|
|
268
|
+
import { FormsModule } from '@angular/forms';
|
|
269
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
270
|
+
import { RadioButtonModule } from '@exhaustive-ui/core/radiobutton';
|
|
271
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
272
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
273
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
274
|
+
|
|
275
|
+
@Component({
|
|
276
|
+
template: `
|
|
277
|
+
<p-toast />
|
|
278
|
+
<div class="card flex justify-center">
|
|
279
|
+
<form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex flex-col gap-4">
|
|
280
|
+
<div class="flex flex-wrap gap-4">
|
|
281
|
+
@for (category of categories; track category.name) {
|
|
282
|
+
<div class="flex items-center gap-2">
|
|
283
|
+
<p-radiobutton [(ngModel)]="ingredient" [inputId]="category.key" [value]="category" [invalid]="isInvalid(exampleForm)" name="ingredient" />
|
|
284
|
+
<label [for]="category.key"> {{ category.name }} </label>
|
|
285
|
+
</div>
|
|
286
|
+
}
|
|
287
|
+
</div>
|
|
288
|
+
@if (isInvalid(exampleForm)) {
|
|
289
|
+
<p-message severity="error" size="small" variant="simple"> At least one ingredient must be selected. </p-message>
|
|
290
|
+
}
|
|
291
|
+
<button pButton severity="secondary" type="submit">
|
|
292
|
+
<span pButtonLabel>Submit</span>
|
|
293
|
+
</button>
|
|
294
|
+
</form>
|
|
295
|
+
</div>
|
|
296
|
+
`,
|
|
297
|
+
standalone: true,
|
|
298
|
+
imports: [MessageModule, RadioButtonModule, ToastModule, ButtonModule, FormsModule],
|
|
299
|
+
providers: [MessageService]
|
|
300
|
+
})
|
|
301
|
+
export class RadiobuttonTemplatedrivenformsDemo {
|
|
302
|
+
private messageService = inject(MessageService);
|
|
303
|
+
messageService = inject(MessageService);
|
|
304
|
+
formSubmitted: boolean = false;
|
|
305
|
+
ingredient!: any;
|
|
306
|
+
categories: any[];
|
|
307
|
+
|
|
308
|
+
isInvalid(form: NgForm) {
|
|
309
|
+
return !this.ingredient && form.submitted;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
onSubmit(form: NgForm) {
|
|
313
|
+
if (!this.isInvalid(form)) {
|
|
314
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
315
|
+
form.resetForm();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Pass Through Options
|
|
322
|
+
|
|
323
|
+
| Name | Type | Description |
|
|
324
|
+
|------|------|-------------|
|
|
325
|
+
| root | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the root's DOM element. |
|
|
326
|
+
| input | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the input's DOM element. |
|
|
327
|
+
| box | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the box's DOM element. |
|
|
328
|
+
| icon | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the icon's DOM element. |
|
|
329
|
+
|
|
330
|
+
## Theming
|
|
331
|
+
|
|
332
|
+
### CSS Classes
|
|
333
|
+
|
|
334
|
+
| Class | Description |
|
|
335
|
+
|-------|-------------|
|
|
336
|
+
| p-radiobutton | Class name of the root element |
|
|
337
|
+
| p-radiobutton-box | Class name of the box element |
|
|
338
|
+
| p-radiobutton-input | Class name of the input element |
|
|
339
|
+
| p-radiobutton-icon | Class name of the icon element |
|
|
340
|
+
|
|
341
|
+
### Design Tokens
|
|
342
|
+
|
|
343
|
+
| Token | CSS Variable | Description |
|
|
344
|
+
|-------|--------------|-------------|
|
|
345
|
+
| radiobutton.width | --p-radiobutton-width | Width of root |
|
|
346
|
+
| radiobutton.height | --p-radiobutton-height | Height of root |
|
|
347
|
+
| radiobutton.background | --p-radiobutton-background | Background of root |
|
|
348
|
+
| radiobutton.checked.background | --p-radiobutton-checked-background | Checked background of root |
|
|
349
|
+
| radiobutton.checked.hover.background | --p-radiobutton-checked-hover-background | Checked hover background of root |
|
|
350
|
+
| radiobutton.disabled.background | --p-radiobutton-disabled-background | Disabled background of root |
|
|
351
|
+
| radiobutton.filled.background | --p-radiobutton-filled-background | Filled background of root |
|
|
352
|
+
| radiobutton.border.color | --p-radiobutton-border-color | Border color of root |
|
|
353
|
+
| radiobutton.hover.border.color | --p-radiobutton-hover-border-color | Hover border color of root |
|
|
354
|
+
| radiobutton.focus.border.color | --p-radiobutton-focus-border-color | Focus border color of root |
|
|
355
|
+
| radiobutton.checked.border.color | --p-radiobutton-checked-border-color | Checked border color of root |
|
|
356
|
+
| radiobutton.checked.hover.border.color | --p-radiobutton-checked-hover-border-color | Checked hover border color of root |
|
|
357
|
+
| radiobutton.checked.focus.border.color | --p-radiobutton-checked-focus-border-color | Checked focus border color of root |
|
|
358
|
+
| radiobutton.checked.disabled.border.color | --p-radiobutton-checked-disabled-border-color | Checked disabled border color of root |
|
|
359
|
+
| radiobutton.invalid.border.color | --p-radiobutton-invalid-border-color | Invalid border color of root |
|
|
360
|
+
| radiobutton.shadow | --p-radiobutton-shadow | Shadow of root |
|
|
361
|
+
| radiobutton.focus.ring.width | --p-radiobutton-focus-ring-width | Focus ring width of root |
|
|
362
|
+
| radiobutton.focus.ring.style | --p-radiobutton-focus-ring-style | Focus ring style of root |
|
|
363
|
+
| radiobutton.focus.ring.color | --p-radiobutton-focus-ring-color | Focus ring color of root |
|
|
364
|
+
| radiobutton.focus.ring.offset | --p-radiobutton-focus-ring-offset | Focus ring offset of root |
|
|
365
|
+
| radiobutton.focus.ring.shadow | --p-radiobutton-focus-ring-shadow | Focus ring shadow of root |
|
|
366
|
+
| radiobutton.transition.duration | --p-radiobutton-transition-duration | Transition duration of root |
|
|
367
|
+
| radiobutton.sm.width | --p-radiobutton-sm-width | Sm width of root |
|
|
368
|
+
| radiobutton.sm.height | --p-radiobutton-sm-height | Sm height of root |
|
|
369
|
+
| radiobutton.lg.width | --p-radiobutton-lg-width | Lg width of root |
|
|
370
|
+
| radiobutton.lg.height | --p-radiobutton-lg-height | Lg height of root |
|
|
371
|
+
| radiobutton.icon.size | --p-radiobutton-icon-size | Size of icon |
|
|
372
|
+
| radiobutton.icon.checked.color | --p-radiobutton-icon-checked-color | Checked color of icon |
|
|
373
|
+
| radiobutton.icon.checked.hover.color | --p-radiobutton-icon-checked-hover-color | Checked hover color of icon |
|
|
374
|
+
| radiobutton.icon.disabled.color | --p-radiobutton-icon-disabled-color | Disabled color of icon |
|
|
375
|
+
| radiobutton.icon.sm.size | --p-radiobutton-icon-sm-size | Sm size of icon |
|
|
376
|
+
| radiobutton.icon.lg.size | --p-radiobutton-icon-lg-size | Lg size of icon |
|
|
377
|
+
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# Angular Rating Component
|
|
2
|
+
|
|
3
|
+
Rating component is a star based selection input.
|
|
4
|
+
|
|
5
|
+
## Accessibility
|
|
6
|
+
|
|
7
|
+
Screen Reader Rating component internally uses radio buttons that are only visible to screen readers. The value to read for item is retrieved from the locale API via star and stars of the aria property.
|
|
8
|
+
|
|
9
|
+
## Basic
|
|
10
|
+
|
|
11
|
+
Two-way value binding is defined using ngModel .
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Component } from '@angular/core';
|
|
15
|
+
import { FormsModule } from '@angular/forms';
|
|
16
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
template: `
|
|
20
|
+
<div class="card flex justify-center">
|
|
21
|
+
<p-rating [(ngModel)]="value" />
|
|
22
|
+
</div>
|
|
23
|
+
`,
|
|
24
|
+
standalone: true,
|
|
25
|
+
imports: [RatingModule, FormsModule]
|
|
26
|
+
})
|
|
27
|
+
export class RatingBasicDemo {
|
|
28
|
+
value!: number;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Disabled
|
|
33
|
+
|
|
34
|
+
When disabled is present, a visual hint is applied to indicate that the Knob cannot be interacted with.
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { Component } from '@angular/core';
|
|
38
|
+
import { FormsModule } from '@angular/forms';
|
|
39
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
40
|
+
|
|
41
|
+
@Component({
|
|
42
|
+
template: `
|
|
43
|
+
<div class="card flex justify-center">
|
|
44
|
+
<p-rating [(ngModel)]="value" [disabled]="true" />
|
|
45
|
+
</div>
|
|
46
|
+
`,
|
|
47
|
+
standalone: true,
|
|
48
|
+
imports: [RatingModule, FormsModule]
|
|
49
|
+
})
|
|
50
|
+
export class RatingDisabledDemo {
|
|
51
|
+
value: number = 5;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Number of Stars
|
|
56
|
+
|
|
57
|
+
Number of stars to display is defined with stars property.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { Component } from '@angular/core';
|
|
61
|
+
import { FormsModule } from '@angular/forms';
|
|
62
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
63
|
+
|
|
64
|
+
@Component({
|
|
65
|
+
template: `
|
|
66
|
+
<div class="card flex justify-center">
|
|
67
|
+
<p-rating [(ngModel)]="value" [stars]="10" />
|
|
68
|
+
</div>
|
|
69
|
+
`,
|
|
70
|
+
standalone: true,
|
|
71
|
+
imports: [RatingModule, FormsModule]
|
|
72
|
+
})
|
|
73
|
+
export class RatingNumberofstarsDemo {
|
|
74
|
+
value: number = 5;
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## reactiveforms-doc
|
|
79
|
+
|
|
80
|
+
Rating can also be used with reactive forms. In this case, the formControlName property is used to bind the component to a form control.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Component, inject } from '@angular/core';
|
|
84
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
85
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
86
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
87
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
88
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
89
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
90
|
+
|
|
91
|
+
@Component({
|
|
92
|
+
template: `
|
|
93
|
+
<p-toast />
|
|
94
|
+
<div class="card flex justify-center">
|
|
95
|
+
<form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4 w-40">
|
|
96
|
+
<div class="flex flex-col items-center gap-2">
|
|
97
|
+
<p-rating formControlName="ratingValue" [invalid]="isInvalid('ratingValue')" />
|
|
98
|
+
@if (isInvalid('ratingValue')) {
|
|
99
|
+
<p-message severity="error" size="small" variant="simple">Value is required.</p-message>
|
|
100
|
+
}
|
|
101
|
+
</div>
|
|
102
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
103
|
+
</form>
|
|
104
|
+
</div>
|
|
105
|
+
`,
|
|
106
|
+
standalone: true,
|
|
107
|
+
imports: [MessageModule, RatingModule, ToastModule, ButtonModule, ReactiveFormsModule],
|
|
108
|
+
providers: [MessageService]
|
|
109
|
+
})
|
|
110
|
+
export class RatingReactiveformsDemo {
|
|
111
|
+
private messageService = inject(MessageService);
|
|
112
|
+
messageService = inject(MessageService);
|
|
113
|
+
exampleForm: FormGroup | undefined;
|
|
114
|
+
formSubmitted: boolean = false;
|
|
115
|
+
|
|
116
|
+
constructor() {
|
|
117
|
+
this.exampleForm = this.fb.group({
|
|
118
|
+
ratingValue: [undefined, Validators.required]
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
onSubmit() {
|
|
123
|
+
this.formSubmitted = true;
|
|
124
|
+
if (this.exampleForm.valid) {
|
|
125
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
126
|
+
this.exampleForm.reset();
|
|
127
|
+
this.formSubmitted = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
isInvalid(controlName: string) {
|
|
132
|
+
const control = this.exampleForm.get(controlName);
|
|
133
|
+
return control?.invalid && (control.touched || this.formSubmitted);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Readonly
|
|
139
|
+
|
|
140
|
+
When readonly present, value cannot be edited.
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { Component } from '@angular/core';
|
|
144
|
+
import { FormsModule } from '@angular/forms';
|
|
145
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
146
|
+
|
|
147
|
+
@Component({
|
|
148
|
+
template: `
|
|
149
|
+
<div class="card flex justify-center">
|
|
150
|
+
<p-rating [(ngModel)]="value" [readonly]="true" />
|
|
151
|
+
</div>
|
|
152
|
+
`,
|
|
153
|
+
standalone: true,
|
|
154
|
+
imports: [RatingModule, FormsModule]
|
|
155
|
+
})
|
|
156
|
+
export class RatingReadonlyDemo {
|
|
157
|
+
value: number = 3;
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Template
|
|
162
|
+
|
|
163
|
+
Templating allows customizing the content where the icon instance is available as the implicit variable.
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { Component } from '@angular/core';
|
|
167
|
+
import { FormsModule } from '@angular/forms';
|
|
168
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
169
|
+
|
|
170
|
+
@Component({
|
|
171
|
+
template: `
|
|
172
|
+
<div class="card flex justify-center">
|
|
173
|
+
<p-rating [(ngModel)]="value">
|
|
174
|
+
<ng-template #onicon>
|
|
175
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/rating/custom-icon-active.png" height="24" width="24" />
|
|
176
|
+
</ng-template>
|
|
177
|
+
<ng-template #officon>
|
|
178
|
+
<img src="https://exhaustive-ui.e-xiste.com/demo/rating/custom-icon.png" height="24" width="24" />
|
|
179
|
+
</ng-template>
|
|
180
|
+
</p-rating>
|
|
181
|
+
</div>
|
|
182
|
+
`,
|
|
183
|
+
standalone: true,
|
|
184
|
+
imports: [RatingModule, FormsModule]
|
|
185
|
+
})
|
|
186
|
+
export class RatingTemplateDemo {
|
|
187
|
+
value!: number;
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## templatedrivenforms-doc
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { Component, inject } from '@angular/core';
|
|
195
|
+
import { FormsModule } from '@angular/forms';
|
|
196
|
+
import { MessageModule } from '@exhaustive-ui/core/message';
|
|
197
|
+
import { RatingModule } from '@exhaustive-ui/core/rating';
|
|
198
|
+
import { ToastModule } from '@exhaustive-ui/core/toast';
|
|
199
|
+
import { ButtonModule } from '@exhaustive-ui/core/button';
|
|
200
|
+
import { MessageService } from '@exhaustive-ui/core/api';
|
|
201
|
+
|
|
202
|
+
@Component({
|
|
203
|
+
template: `
|
|
204
|
+
<p-toast />
|
|
205
|
+
<div class="card flex justify-center">
|
|
206
|
+
<form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex flex-col gap-4 w-40">
|
|
207
|
+
<div class="flex flex-col items-center gap-2">
|
|
208
|
+
<p-rating #ratingValue="ngModel" [(ngModel)]="value" required name="ratingValue" [invalid]="ratingValue.invalid && (ratingValue.touched || exampleForm.submitted)" />
|
|
209
|
+
@if (ratingValue.invalid && (ratingValue.touched || exampleForm.submitted)) {
|
|
210
|
+
<p-message severity="error" size="small" variant="simple">Value is required.</p-message>
|
|
211
|
+
}
|
|
212
|
+
</div>
|
|
213
|
+
<button pButton severity="secondary" type="submit"><span pButtonLabel>Submit</span></button>
|
|
214
|
+
</form>
|
|
215
|
+
</div>
|
|
216
|
+
`,
|
|
217
|
+
standalone: true,
|
|
218
|
+
imports: [MessageModule, RatingModule, ToastModule, ButtonModule, FormsModule],
|
|
219
|
+
providers: [MessageService]
|
|
220
|
+
})
|
|
221
|
+
export class RatingTemplatedrivenformsDemo {
|
|
222
|
+
private messageService = inject(MessageService);
|
|
223
|
+
messageService = inject(MessageService);
|
|
224
|
+
value: any;
|
|
225
|
+
|
|
226
|
+
onSubmit(form: any) {
|
|
227
|
+
if (form.valid) {
|
|
228
|
+
this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
|
|
229
|
+
form.resetForm();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Rating
|
|
236
|
+
|
|
237
|
+
Rating is an extension to standard radio button element with theming.
|
|
238
|
+
|
|
239
|
+
### Props
|
|
240
|
+
|
|
241
|
+
| Name | Type | Default | Description |
|
|
242
|
+
|------|------|---------|-------------|
|
|
243
|
+
| dt | InputSignal<Object> | undefined | Defines scoped design tokens of the component. |
|
|
244
|
+
| unstyled | InputSignal<boolean> | undefined | Indicates whether the component should be rendered without styles. |
|
|
245
|
+
| pt | InputSignal<RatingPassThrough> | undefined | Used to pass attributes to DOM elements inside the component. |
|
|
246
|
+
| ptOptions | InputSignal<PassThroughOptions> | undefined | Used to configure passthrough(pt) options of the component. |
|
|
247
|
+
| required | InputSignalWithTransform<boolean, unknown> | false | There must be a value (if set). |
|
|
248
|
+
| invalid | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have invalid state style. |
|
|
249
|
+
| disabled | InputSignalWithTransform<boolean, unknown> | false | When present, it specifies that the component should have disabled state style. |
|
|
250
|
+
| name | InputSignal<string> | undefined | When present, it specifies that the name of the input. |
|
|
251
|
+
| readonly | InputSignalWithTransform<boolean, unknown> | ... | When present, changing the value is not possible. |
|
|
252
|
+
| stars | InputSignalWithTransform<number, unknown> | ... | Number of stars. |
|
|
253
|
+
| iconOnClass | InputSignal<string> | ... | Style class of the on icon. |
|
|
254
|
+
| iconOnStyle | InputSignal<{ [klass: string]: any }> | ... | Inline style of the on icon. |
|
|
255
|
+
| iconOffClass | InputSignal<string> | ... | Style class of the off icon. |
|
|
256
|
+
| iconOffStyle | InputSignal<{ [klass: string]: any }> | ... | Inline style of the off icon. |
|
|
257
|
+
| autofocus | InputSignalWithTransform<boolean, unknown> | ... | When present, it specifies that the component should automatically get focus on load. |
|
|
258
|
+
|
|
259
|
+
### Emits
|
|
260
|
+
|
|
261
|
+
| Name | Parameters | Description |
|
|
262
|
+
|------|------------|-------------|
|
|
263
|
+
| onRate | event: RatingRateEvent | Emitted on value change. |
|
|
264
|
+
| onFocus | event: FocusEvent | Emitted when the rating receives focus. |
|
|
265
|
+
| onBlur | event: FocusEvent | Emitted when the rating loses focus. |
|
|
266
|
+
|
|
267
|
+
### Templates
|
|
268
|
+
|
|
269
|
+
| Name | Type | Description |
|
|
270
|
+
|------|------|-------------|
|
|
271
|
+
| onicon | TemplateRef<RatingIconTemplateContext> | Custom on icon template. |
|
|
272
|
+
| officon | TemplateRef<RatingIconTemplateContext> | Custom off icon template. |
|
|
273
|
+
|
|
274
|
+
## Pass Through Options
|
|
275
|
+
|
|
276
|
+
| Name | Type | Description |
|
|
277
|
+
|------|------|-------------|
|
|
278
|
+
| host | PassThroughOption<HTMLElement, I> | Used to pass attributes to the host's DOM element. |
|
|
279
|
+
| root | PassThroughOption<HTMLElement, I> | Used to pass attributes to the root's DOM element. |
|
|
280
|
+
| option | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the option's DOM element. |
|
|
281
|
+
| onIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the on icon's DOM element. |
|
|
282
|
+
| offIcon | PassThroughOption<HTMLElement, I> | Used to pass attributes to the off icon's DOM element. |
|
|
283
|
+
| hiddenOptionInputContainer | PassThroughOption<HTMLSpanElement, I> | Used to pass attributes to the hidden option input container's DOM element. |
|
|
284
|
+
| hiddenOptionInput | PassThroughOption<HTMLInputElement, I> | Used to pass attributes to the hidden option input's DOM element. |
|
|
285
|
+
|
|
286
|
+
## Theming
|
|
287
|
+
|
|
288
|
+
### CSS Classes
|
|
289
|
+
|
|
290
|
+
| Class | Description |
|
|
291
|
+
|-------|-------------|
|
|
292
|
+
| p-rating | Class name of the root element |
|
|
293
|
+
| p-rating-option | Class name of the option element |
|
|
294
|
+
| p-rating-on-icon | Class name of the on icon element |
|
|
295
|
+
| p-rating-off-icon | Class name of the off icon element |
|
|
296
|
+
|
|
297
|
+
### Design Tokens
|
|
298
|
+
|
|
299
|
+
| Token | CSS Variable | Description |
|
|
300
|
+
|-------|--------------|-------------|
|
|
301
|
+
| rating.gap | --p-rating-gap | Gap of root |
|
|
302
|
+
| rating.transition.duration | --p-rating-transition-duration | Transition duration of root |
|
|
303
|
+
| rating.focus.ring.width | --p-rating-focus-ring-width | Focus ring width of root |
|
|
304
|
+
| rating.focus.ring.style | --p-rating-focus-ring-style | Focus ring style of root |
|
|
305
|
+
| rating.focus.ring.color | --p-rating-focus-ring-color | Focus ring color of root |
|
|
306
|
+
| rating.focus.ring.offset | --p-rating-focus-ring-offset | Focus ring offset of root |
|
|
307
|
+
| rating.focus.ring.shadow | --p-rating-focus-ring-shadow | Focus ring shadow of root |
|
|
308
|
+
| rating.icon.size | --p-rating-icon-size | Size of icon |
|
|
309
|
+
| rating.icon.color | --p-rating-icon-color | Color of icon |
|
|
310
|
+
| rating.icon.hover.color | --p-rating-icon-hover-color | Hover color of icon |
|
|
311
|
+
| rating.icon.active.color | --p-rating-icon-active-color | Active color of icon |
|
|
312
|
+
|