@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.
- package/LICENSE.md +45 -21
- package/README.md +48 -250
- package/data/components.json +47269 -0
- package/data/llms/components/accordion.md +629 -0
- package/data/llms/components/animateonscroll.md +165 -0
- package/data/llms/components/autocomplete.md +995 -0
- package/data/llms/components/avatar.md +264 -0
- package/data/llms/components/badge.md +200 -0
- package/data/llms/components/blockui.md +99 -0
- package/data/llms/components/breadcrumb.md +269 -0
- package/data/llms/components/button.md +902 -0
- package/data/llms/components/card.md +209 -0
- package/data/llms/components/carousel.md +506 -0
- package/data/llms/components/cascadeselect.md +1207 -0
- package/data/llms/components/chart.md +1022 -0
- package/data/llms/components/checkbox.md +401 -0
- package/data/llms/components/chip.md +206 -0
- package/data/llms/components/colorpicker.md +213 -0
- package/data/llms/components/commandmenu.md +660 -0
- package/data/llms/components/compare.md +407 -0
- package/data/llms/components/confirmdialog.md +343 -0
- package/data/llms/components/confirmpopup.md +252 -0
- package/data/llms/components/contextmenu.md +522 -0
- package/data/llms/components/datatable.md +5266 -0
- package/data/llms/components/dataview.md +569 -0
- package/data/llms/components/datepicker.md +964 -0
- package/data/llms/components/deferredcontent.md +96 -0
- package/data/llms/components/dialog.md +702 -0
- package/data/llms/components/divider.md +152 -0
- package/data/llms/components/dock.md +488 -0
- package/data/llms/components/drawer.md +469 -0
- package/data/llms/components/dynamicdialog.md +214 -0
- package/data/llms/components/editor.md +205 -0
- package/data/llms/components/fieldset.md +253 -0
- package/data/llms/components/fileupload.md +459 -0
- package/data/llms/components/floatlabel.md +144 -0
- package/data/llms/components/fluid.md +104 -0
- package/data/llms/components/focustrap.md +59 -0
- package/data/llms/components/forms.md +344 -0
- package/data/llms/components/galleria.md +1119 -0
- package/data/llms/components/gallery.md +1003 -0
- package/data/llms/components/iconfield.md +283 -0
- package/data/llms/components/iftalabel.md +96 -0
- package/data/llms/components/image.md +179 -0
- package/data/llms/components/imagecompare.md +108 -0
- package/data/llms/components/inplace.md +183 -0
- package/data/llms/components/inputcolor.md +869 -0
- package/data/llms/components/inputgroup.md +419 -0
- package/data/llms/components/inputmask.md +345 -0
- package/data/llms/components/inputnumber.md +551 -0
- package/data/llms/components/inputotp.md +345 -0
- package/data/llms/components/inputpassword.md +738 -0
- package/data/llms/components/inputtags.md +432 -0
- package/data/llms/components/inputtext.md +569 -0
- package/data/llms/components/installation.md +1 -0
- package/data/llms/components/keyfilter.md +116 -0
- package/data/llms/components/knob.md +318 -0
- package/data/llms/components/label.md +151 -0
- package/data/llms/components/laravel.md +53 -0
- package/data/llms/components/listbox.md +636 -0
- package/data/llms/components/mask.md +203 -0
- package/data/llms/components/mcp.md +39 -0
- package/data/llms/components/megamenu.md +563 -0
- package/data/llms/components/menu.md +651 -0
- package/data/llms/components/menubar.md +446 -0
- package/data/llms/components/message.md +497 -0
- package/data/llms/components/metergroup.md +281 -0
- package/data/llms/components/multiselect.md +752 -0
- package/data/llms/components/orderlist.md +224 -0
- package/data/llms/components/organizationchart.md +418 -0
- package/data/llms/components/paginator.md +221 -0
- package/data/llms/components/panel.md +321 -0
- package/data/llms/components/panelmenu.md +703 -0
- package/data/llms/components/password.md +657 -0
- package/data/llms/components/picklist.md +286 -0
- package/data/llms/components/popover.md +145 -0
- package/data/llms/components/progressbar.md +242 -0
- package/data/llms/components/progressspinner.md +104 -0
- package/data/llms/components/radiobutton.md +427 -0
- package/data/llms/components/rating.md +312 -0
- package/data/llms/components/ripple.md +91 -0
- package/data/llms/components/scrollarea.md +700 -0
- package/data/llms/components/scrollpanel.md +131 -0
- package/data/llms/components/scrolltop.md +87 -0
- package/data/llms/components/select.md +1251 -0
- package/data/llms/components/selectbutton.md +268 -0
- package/data/llms/components/sidebar.md +2232 -0
- package/data/llms/components/skeleton.md +302 -0
- package/data/llms/components/slider.md +416 -0
- package/data/llms/components/speeddial.md +402 -0
- package/data/llms/components/splitbutton.md +840 -0
- package/data/llms/components/splitter.md +447 -0
- package/data/llms/components/stepper.md +551 -0
- package/data/llms/components/styleclass.md +226 -0
- package/data/llms/components/tabs.md +609 -0
- package/data/llms/components/tag.md +178 -0
- package/data/llms/components/terminal.md +123 -0
- package/data/llms/components/textarea.md +519 -0
- package/data/llms/components/tieredmenu.md +578 -0
- package/data/llms/components/timeline.md +494 -0
- package/data/llms/components/toast.md +472 -0
- package/data/llms/components/togglebutton.md +276 -0
- package/data/llms/components/toggleswitch.md +271 -0
- package/data/llms/components/toolbar.md +140 -0
- package/data/llms/components/tooltip.md +160 -0
- package/data/llms/components/tree.md +1076 -0
- package/data/llms/components/treeselect.md +660 -0
- package/data/llms/components/treetable.md +2493 -0
- package/data/llms/components/virtualscroller.md +265 -0
- package/data/llms/guides/autoimport.md +28 -0
- package/data/llms/guides/cdn.md +72 -0
- package/data/llms/guides/configuration.md +158 -0
- package/data/llms/guides/customicons.md +67 -0
- package/data/llms/guides/guides/accessibility.md +27 -0
- package/data/llms/guides/guides/animations.md +119 -0
- package/data/llms/guides/guides/rtl.md +7 -0
- package/data/llms/guides/icons.md +136 -0
- package/data/llms/guides/installation.md +3 -0
- package/data/llms/guides/laravel.md +66 -0
- package/data/llms/guides/llms.md +15 -0
- package/data/llms/guides/mcp.md +104 -0
- package/data/llms/guides/migration/v4.md +15 -0
- package/data/llms/guides/migration/v5.md +15 -0
- package/data/llms/guides/nuxt.md +141 -0
- package/data/llms/guides/passthrough.md +137 -0
- package/data/llms/guides/primeclt.md +43 -0
- package/data/llms/guides/tailwind.md +151 -0
- package/data/llms/guides/theming/styled.md +497 -0
- package/data/llms/guides/theming/unstyled.md +57 -0
- package/data/llms/guides/uikit.md +3 -0
- package/data/llms/guides/vite.md +90 -0
- package/data/llms/llms-full.txt +54465 -0
- package/data/llms/llms.txt +132 -0
- package/data/llms/pages/accessibility.md +27 -0
- package/data/llms/pages/animations.md +119 -0
- package/data/llms/pages/autoimport.md +28 -0
- package/data/llms/pages/cdn.md +72 -0
- package/data/llms/pages/configuration.md +158 -0
- package/data/llms/pages/contribution.md +31 -0
- package/data/llms/pages/customicons.md +67 -0
- package/data/llms/pages/designer.md +79 -0
- package/data/llms/pages/dynamicimports.md +7 -0
- package/data/llms/pages/forms.md +63 -0
- package/data/llms/pages/guides/accessibility.md +27 -0
- package/data/llms/pages/guides/animations.md +119 -0
- package/data/llms/pages/guides/rtl.md +7 -0
- package/data/llms/pages/icons.md +136 -0
- package/data/llms/pages/installation.md +3 -0
- package/data/llms/pages/introduction.md +23 -0
- package/data/llms/pages/laravel.md +66 -0
- package/data/llms/pages/llms.md +15 -0
- package/data/llms/pages/mcp.md +104 -0
- package/data/llms/pages/migration/v4.md +15 -0
- package/data/llms/pages/migration/v5.md +15 -0
- package/data/llms/pages/nuxt.md +141 -0
- package/data/llms/pages/passthrough.md +137 -0
- package/data/llms/pages/primeclt.md +43 -0
- package/data/llms/pages/rtl.md +7 -0
- package/data/llms/pages/setup.md +3 -0
- package/data/llms/pages/styled.md +497 -0
- package/data/llms/pages/tailwind.md +151 -0
- package/data/llms/pages/theming/styled.md +497 -0
- package/data/llms/pages/theming/unstyled.md +57 -0
- package/data/llms/pages/uikit.md +3 -0
- package/data/llms/pages/unstyled.md +57 -0
- package/data/llms/pages/v4.md +15 -0
- package/data/llms/pages/v5.md +15 -0
- package/data/llms/pages/vite.md +90 -0
- package/data/manifest.json +11117 -0
- package/data/mcp-data.json +55940 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +66066 -72541
- package/package.json +10 -12
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# ProgressSpinner
|
|
2
|
+
|
|
3
|
+
ProgressSpinner is a process status indicator that supports both determinate and indeterminate modes.
|
|
4
|
+
|
|
5
|
+
## Indeterminate
|
|
6
|
+
|
|
7
|
+
An animated spinner indicating an indeterminate loading state is displayed by default when no value is provided.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex justify-center">
|
|
12
|
+
<ProgressSpinner aria-label="loading" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Determinate
|
|
18
|
+
|
|
19
|
+
Set a numeric value property to display a determinate progress indicator with a track and range.
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<template>
|
|
23
|
+
<div class="flex justify-center">
|
|
24
|
+
<ProgressSpinner :value="75" />
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Custom
|
|
30
|
+
|
|
31
|
+
ProgressSpinner can be customized with styling property like strokeWidth and the pt passthrough API.
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<template>
|
|
35
|
+
<div class="flex justify-center">
|
|
36
|
+
<ProgressSpinner
|
|
37
|
+
:strokeWidth="18"
|
|
38
|
+
animationDuration=".5s"
|
|
39
|
+
style="width: 50px; height: 50px"
|
|
40
|
+
:pt="{
|
|
41
|
+
circleTrack: { style: { stroke: 'transparent' } }
|
|
42
|
+
}"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Accessibility
|
|
49
|
+
|
|
50
|
+
Screen Reader ProgressSpinner components uses progressbar role. Value to describe the component can be defined using aria-labelledby and aria-label props. Keyboard Support Component does not include any interactive elements.
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<template>
|
|
54
|
+
<ProgressSpinner aria-label="Loading" />
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Progress Spinner API
|
|
59
|
+
|
|
60
|
+
### Props
|
|
61
|
+
|
|
62
|
+
| Name |Type |Default |Description |
|
|
63
|
+
| --- | --- | --- | --- |
|
|
64
|
+
| value | null \| number | null | Current progress value. When null, the component is in indeterminate mode. |
|
|
65
|
+
| min | number | 0 | Minimum value of the progress. |
|
|
66
|
+
| max | number | 100 | Maximum value of the progress. |
|
|
67
|
+
| strokeWidth | number | 4 | Width of the circle stroke. |
|
|
68
|
+
| animationDuration | string | '2s' | Duration of the rotate animation. |
|
|
69
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
70
|
+
| pt | PassThrough<ProgressSpinnerPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
71
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
72
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
73
|
+
|
|
74
|
+
### Pass Through Options
|
|
75
|
+
|
|
76
|
+
| Name |Type |Description |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| root | ProgressSpinnerPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
79
|
+
| circle | ProgressSpinnerPassThroughOptionType | Used to pass attributes to the circle SVG element. |
|
|
80
|
+
| circleTrack | ProgressSpinnerPassThroughOptionType | Used to pass attributes to the circle track element. |
|
|
81
|
+
| circleRange | ProgressSpinnerPassThroughOptionType | Used to pass attributes to the circle range element. |
|
|
82
|
+
| value | ProgressSpinnerPassThroughOptionType | Used to pass attributes to the value text element. |
|
|
83
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
84
|
+
|
|
85
|
+
### Theming
|
|
86
|
+
|
|
87
|
+
### CSS Classes
|
|
88
|
+
|
|
89
|
+
| Class |Description |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| p-progressspinner | Class name of the root element |
|
|
92
|
+
| p-progressspinner-circle | Class name of the circle element |
|
|
93
|
+
| p-progressspinner-circle-track | Class name of the circle track element |
|
|
94
|
+
| p-progressspinner-circle-range | Class name of the circle range element |
|
|
95
|
+
| p-progressspinner-value | Class name of the value element |
|
|
96
|
+
|
|
97
|
+
### Design Tokens
|
|
98
|
+
|
|
99
|
+
| Token |CSS Variable |Description |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| progressspinner.color.one | --p-progressspinner-color-one | Color one of root |
|
|
102
|
+
| progressspinner.color.two | --p-progressspinner-color-two | Color two of root |
|
|
103
|
+
| progressspinner.color.three | --p-progressspinner-color-three | Color three of root |
|
|
104
|
+
| progressspinner.color.four | --p-progressspinner-color-four | Color four of root |
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
# RadioButton
|
|
2
|
+
|
|
3
|
+
RadioButton is an extension to standard radio button element with theming.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
Selects a single option from a group of mutually exclusive choices.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex items-center justify-center">
|
|
12
|
+
<div class="flex flex-col gap-3">
|
|
13
|
+
<div class="flex items-center gap-3">
|
|
14
|
+
<RadioButton v-model="ingredient" inputId="ingredient-strawberry" name="fruit" value="strawberry" />
|
|
15
|
+
<Label for="ingredient-strawberry" class="text-sm!">🍓 Strawberry</Label>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="flex items-center gap-3">
|
|
18
|
+
<RadioButton v-model="ingredient" inputId="ingredient-banana" name="fruit" value="banana" />
|
|
19
|
+
<Label for="ingredient-banana" class="text-sm!">🍌 Banana</Label>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="flex items-center gap-3">
|
|
22
|
+
<RadioButton v-model="ingredient" inputId="ingredient-watermelon" name="fruit" value="watermelon" />
|
|
23
|
+
<Label for="ingredient-watermelon" class="text-sm!">🍉 Watermelon</Label>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup>
|
|
30
|
+
import { ref } from 'vue';
|
|
31
|
+
|
|
32
|
+
const ingredient = ref(null);
|
|
33
|
+
<\/script>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Group
|
|
37
|
+
|
|
38
|
+
RadioButton is used as a controlled input with value and v-model properties.
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<template>
|
|
42
|
+
<div class="flex justify-center">
|
|
43
|
+
<div class="flex flex-wrap gap-4">
|
|
44
|
+
<div class="flex items-center">
|
|
45
|
+
<RadioButton v-model="ingredient" inputId="ingredient1" name="pizza" value="Cheese" />
|
|
46
|
+
<Label for="ingredient1" class="text-sm! ml-2">Cheese</Label>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="flex items-center">
|
|
49
|
+
<RadioButton v-model="ingredient" inputId="ingredient2" name="pizza" value="Mushroom" />
|
|
50
|
+
<Label for="ingredient2" class="text-sm! ml-2">Mushroom</Label>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="flex items-center">
|
|
53
|
+
<RadioButton v-model="ingredient" inputId="ingredient3" name="pizza" value="Pepper" />
|
|
54
|
+
<Label for="ingredient3" class="text-sm! ml-2">Pepper</Label>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="flex items-center">
|
|
57
|
+
<RadioButton v-model="ingredient" inputId="ingredient4" name="pizza" value="Onion" />
|
|
58
|
+
<Label for="ingredient4" class="text-sm! ml-2">Onion</Label>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup>
|
|
65
|
+
import { ref } from 'vue';
|
|
66
|
+
|
|
67
|
+
const ingredient = ref(null);
|
|
68
|
+
<\/script>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Dynamic
|
|
72
|
+
|
|
73
|
+
RadioButtons can be generated using a list of values.
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<template>
|
|
77
|
+
<div class="flex justify-center">
|
|
78
|
+
<div class="flex flex-wrap gap-4">
|
|
79
|
+
<div v-for="category in categories" :key="category.key" class="flex items-center gap-2">
|
|
80
|
+
<RadioButton v-model="selectedCategory" :inputId="category.key" name="category" :value="category.key" />
|
|
81
|
+
<Label :for="category.key" class="text-sm!">{{ category.name }}</Label>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script setup>
|
|
88
|
+
import { ref } from 'vue';
|
|
89
|
+
|
|
90
|
+
const selectedCategory = ref(null);
|
|
91
|
+
const categories = ref([
|
|
92
|
+
{ name: 'Accounting', key: 'A' },
|
|
93
|
+
{ name: 'Marketing', key: 'M' },
|
|
94
|
+
{ name: 'Production', key: 'P' },
|
|
95
|
+
{ name: 'Research', key: 'R' }
|
|
96
|
+
]);
|
|
97
|
+
<\/script>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Card
|
|
101
|
+
|
|
102
|
+
RadioButtons can be displayed in a card style.
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<template>
|
|
106
|
+
<div class="max-w-xs mx-auto">
|
|
107
|
+
<span class="font-medium">Choose a plan:</span>
|
|
108
|
+
<div class="mt-2 flex flex-col gap-3">
|
|
109
|
+
<label
|
|
110
|
+
v-for="plan in plans"
|
|
111
|
+
:key="plan.id"
|
|
112
|
+
:for="'plan-' + plan.id"
|
|
113
|
+
:class="'flex-1 flex items-start gap-2 p-3 rounded-lg border hover:bg-surface-100 dark:hover:bg-surface-800 transition-colors cursor-pointer ' + (selectedPlan === plan.id ? 'border-primary' : 'border-surface')"
|
|
114
|
+
>
|
|
115
|
+
<div class="flex-1 flex flex-col gap-1">
|
|
116
|
+
<div class="flex items-center justify-between gap-2">
|
|
117
|
+
<div class="flex items-center gap-2">
|
|
118
|
+
<span class="font-medium leading-none">{{ plan.name }}</span>
|
|
119
|
+
<Tag v-if="plan.tag" :value="plan.tag" />
|
|
120
|
+
</div>
|
|
121
|
+
<div class="text-sm text-color">
|
|
122
|
+
<span class="font-semibold">{{ plan.price }}</span>
|
|
123
|
+
<span class="text-surface-500">{{ plan.period }}</span>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<span class="text-sm text-surface-500">{{ plan.description }}</span>
|
|
127
|
+
</div>
|
|
128
|
+
<RadioButton v-model="selectedPlan" :inputId="'plan-' + plan.id" name="plan" :value="plan.id" />
|
|
129
|
+
</label>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<script setup>
|
|
135
|
+
import { ref } from 'vue';
|
|
136
|
+
|
|
137
|
+
const selectedPlan = ref('pro');
|
|
138
|
+
const plans = ref([
|
|
139
|
+
{ id: 'starter', name: 'Starter', price: '$0', period: '/month', description: 'For solo developers exploring the platform.', tag: null },
|
|
140
|
+
{ id: 'pro', name: 'Pro', price: '$29', period: '/month', description: 'For growing teams shipping in production.', tag: 'Popular' },
|
|
141
|
+
{ id: 'enterprise', name: 'Enterprise', price: 'Custom', period: '', description: 'For large organizations with custom needs.', tag: null }
|
|
142
|
+
]);
|
|
143
|
+
<\/script>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Sizes
|
|
147
|
+
|
|
148
|
+
RadioButton provides small and large sizes as alternatives to the base.
|
|
149
|
+
|
|
150
|
+
```vue
|
|
151
|
+
<template>
|
|
152
|
+
<div class="flex justify-center">
|
|
153
|
+
<div class="flex flex-wrap gap-4">
|
|
154
|
+
<div class="flex items-center gap-2">
|
|
155
|
+
<RadioButton v-model="size" inputId="size_small" name="size" value="Small" size="small" />
|
|
156
|
+
<Label for="size_small" class="text-sm!">Small</Label>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="flex items-center gap-2">
|
|
159
|
+
<RadioButton v-model="size" inputId="size_normal" name="size" value="Normal" />
|
|
160
|
+
<Label for="size_normal">Normal</Label>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="flex items-center gap-2">
|
|
163
|
+
<RadioButton v-model="size" inputId="size_large" name="size" value="Large" size="large" />
|
|
164
|
+
<Label for="size_large" class="text-lg!">Large</Label>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</template>
|
|
169
|
+
|
|
170
|
+
<script setup>
|
|
171
|
+
import { ref } from 'vue';
|
|
172
|
+
|
|
173
|
+
const size = ref('Normal');
|
|
174
|
+
<\/script>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Filled
|
|
178
|
+
|
|
179
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
180
|
+
|
|
181
|
+
```vue
|
|
182
|
+
<template>
|
|
183
|
+
<div class="flex justify-center">
|
|
184
|
+
<RadioButton v-model="checked" variant="filled" />
|
|
185
|
+
</div>
|
|
186
|
+
</template>
|
|
187
|
+
|
|
188
|
+
<script setup>
|
|
189
|
+
import { ref } from 'vue';
|
|
190
|
+
|
|
191
|
+
const checked = ref(false);
|
|
192
|
+
<\/script>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Disabled
|
|
196
|
+
|
|
197
|
+
When disabled is present, the element cannot be edited and focused.
|
|
198
|
+
|
|
199
|
+
```vue
|
|
200
|
+
<template>
|
|
201
|
+
<div class="flex justify-center gap-2">
|
|
202
|
+
<RadioButton v-model="value" :value="1" disabled />
|
|
203
|
+
<RadioButton v-model="value" :value="2" disabled />
|
|
204
|
+
</div>
|
|
205
|
+
</template>
|
|
206
|
+
|
|
207
|
+
<script setup>
|
|
208
|
+
import { ref } from 'vue';
|
|
209
|
+
|
|
210
|
+
const value = ref(2);
|
|
211
|
+
<\/script>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Invalid
|
|
215
|
+
|
|
216
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation libraries.
|
|
217
|
+
|
|
218
|
+
```vue
|
|
219
|
+
<template>
|
|
220
|
+
<div class="flex justify-center">
|
|
221
|
+
<RadioButton v-model="value" :invalid="!value" />
|
|
222
|
+
</div>
|
|
223
|
+
</template>
|
|
224
|
+
|
|
225
|
+
<script setup>
|
|
226
|
+
import { ref } from 'vue';
|
|
227
|
+
|
|
228
|
+
const value = ref(false);
|
|
229
|
+
<\/script>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Forms
|
|
233
|
+
|
|
234
|
+
RadioButton integrates seamlessly with the PrimeVue Forms library.
|
|
235
|
+
|
|
236
|
+
```vue
|
|
237
|
+
<template>
|
|
238
|
+
<div class="flex justify-center">
|
|
239
|
+
<Form v-slot="$form" :resolver="resolver" :initialValues="initialValues" @submit="onFormSubmit" class="flex flex-col gap-4">
|
|
240
|
+
<div class="flex flex-col gap-2">
|
|
241
|
+
<RadioButtonGroup name="ingredient" class="flex flex-wrap gap-4">
|
|
242
|
+
<div class="flex items-center gap-2">
|
|
243
|
+
<RadioButton inputId="cheese" value="Cheese" />
|
|
244
|
+
<Label for="cheese">Cheese</Label>
|
|
245
|
+
</div>
|
|
246
|
+
<div class="flex items-center gap-2">
|
|
247
|
+
<RadioButton inputId="mushroom" value="Mushroom" />
|
|
248
|
+
<Label for="mushroom">Mushroom</Label>
|
|
249
|
+
</div>
|
|
250
|
+
<div class="flex items-center gap-2">
|
|
251
|
+
<RadioButton inputId="pepper" value="Pepper" />
|
|
252
|
+
<Label for="pepper">Pepper</Label>
|
|
253
|
+
</div>
|
|
254
|
+
<div class="flex items-center gap-2">
|
|
255
|
+
<RadioButton inputId="onion" value="Onion" />
|
|
256
|
+
<Label for="onion">Onion</Label>
|
|
257
|
+
</div>
|
|
258
|
+
</RadioButtonGroup>
|
|
259
|
+
<Message v-if="$form.ingredient?.invalid" severity="error" size="small" variant="simple">{{ $form.ingredient.error?.message }}</Message>
|
|
260
|
+
</div>
|
|
261
|
+
<Button type="submit" severity="secondary">Submit</Button>
|
|
262
|
+
</Form>
|
|
263
|
+
</div>
|
|
264
|
+
</template>
|
|
265
|
+
|
|
266
|
+
<script setup>
|
|
267
|
+
import { ref } from 'vue';
|
|
268
|
+
import { zodResolver } from '@primevue/forms/resolvers/zod';
|
|
269
|
+
import { useToast } from "primevue/usetoast";
|
|
270
|
+
import { z } from 'zod';
|
|
271
|
+
|
|
272
|
+
const toast = useToast();
|
|
273
|
+
const initialValues = ref({
|
|
274
|
+
ingredient: ''
|
|
275
|
+
});
|
|
276
|
+
const resolver = ref(zodResolver(
|
|
277
|
+
z.object({
|
|
278
|
+
ingredient: z.string().min(1, { message: 'Ingredient is required.' })
|
|
279
|
+
})
|
|
280
|
+
));
|
|
281
|
+
|
|
282
|
+
const onFormSubmit = ({ valid }) => {
|
|
283
|
+
if (valid) {
|
|
284
|
+
toast.add({ severity: 'success', summary: 'Form is submitted.', life: 3000 });
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
<\/script>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Accessibility
|
|
291
|
+
|
|
292
|
+
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 id prop or using aria-labelledby , aria-label props. Keyboard Support Key Function tab Moves focus to the checked radio button, if there is none within the group then first radio button receives the focus. left arrow up arrow Moves focus to the previous radio button, if there is none then last radio button receives the focus. right arrow down arrow Moves focus to the next radio button, if there is none then first radio button receives the focus. space If the focused radio button is unchecked, changes the state to checked.
|
|
293
|
+
|
|
294
|
+
```vue
|
|
295
|
+
<template>
|
|
296
|
+
<label for="rb1">One</label>
|
|
297
|
+
<RadioButton inputId="rb1" />
|
|
298
|
+
|
|
299
|
+
<span id="rb2">Two</span>
|
|
300
|
+
<RadioButton aria-labelledby="rb2" />
|
|
301
|
+
|
|
302
|
+
<RadioButton aria-label="Three" />
|
|
303
|
+
</template>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Radio Button API
|
|
307
|
+
|
|
308
|
+
### Props
|
|
309
|
+
|
|
310
|
+
| Name |Type |Default |Description |
|
|
311
|
+
| --- | --- | --- | --- |
|
|
312
|
+
| value | any | - | Value of the checkbox. |
|
|
313
|
+
| modelValue | any | - | Value binding of the checkbox. |
|
|
314
|
+
| defaultValue | any | - | The default value for the input when not controlled by `modelValue` . |
|
|
315
|
+
| name | string | - | Name of the input element. |
|
|
316
|
+
| binary | boolean | - | Allows to select a boolean value. |
|
|
317
|
+
| size | HintedString<"small" \| "large"> | - | Defines the size of the component. |
|
|
318
|
+
| invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
|
|
319
|
+
| disabled | boolean | false | When present, it specifies that the component should be disabled. |
|
|
320
|
+
| variant | null \| HintedString<"outlined" \| "filled"> | null | Specifies the input variant of the component. |
|
|
321
|
+
| readonly | boolean | - | When present, it specifies that an input field is read-only. |
|
|
322
|
+
| tabindex | number | - | Index of the element in tabbing order. |
|
|
323
|
+
| inputId | string | - | Identifier of the underlying input element. |
|
|
324
|
+
| inputStyle | object | - | Inline style of the input field. |
|
|
325
|
+
| inputClass | string \| object | - | Style class of the input field. |
|
|
326
|
+
| ariaLabelledby | string | - | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
|
|
327
|
+
| ariaLabel | string | - | Establishes a string value that labels the component. |
|
|
328
|
+
| formControl | Record<string, any> | - | Form control object, typically used for handling validation and form state. |
|
|
329
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
330
|
+
| pt | PassThrough<RadioButtonPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
331
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
332
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
333
|
+
|
|
334
|
+
### Pass Through Options
|
|
335
|
+
|
|
336
|
+
| Name |Type |Description |
|
|
337
|
+
| --- | --- | --- |
|
|
338
|
+
| root | RadioButtonPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
339
|
+
| input | RadioButtonPassThroughOptionType | Used to pass attributes to the input's DOM element. |
|
|
340
|
+
| box | RadioButtonPassThroughOptionType | Used to pass attributes to the box's DOM element. |
|
|
341
|
+
| icon | RadioButtonPassThroughOptionType | Used to pass attributes to the icon's DOM element. |
|
|
342
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
343
|
+
|
|
344
|
+
### Theming
|
|
345
|
+
|
|
346
|
+
### CSS Classes
|
|
347
|
+
|
|
348
|
+
| Class |Description |
|
|
349
|
+
| --- | --- |
|
|
350
|
+
| p-radiobutton | Class name of the root element |
|
|
351
|
+
| p-radiobutton-box | Class name of the box element |
|
|
352
|
+
| p-radiobutton-input | Class name of the input element |
|
|
353
|
+
| p-radiobutton-icon | Class name of the icon element |
|
|
354
|
+
|
|
355
|
+
### Design Tokens
|
|
356
|
+
|
|
357
|
+
| Token |CSS Variable |Description |
|
|
358
|
+
| --- | --- | --- |
|
|
359
|
+
| radiobutton.width | --p-radiobutton-width | Width of root |
|
|
360
|
+
| radiobutton.height | --p-radiobutton-height | Height of root |
|
|
361
|
+
| radiobutton.background | --p-radiobutton-background | Background of root |
|
|
362
|
+
| radiobutton.checked.background | --p-radiobutton-checked-background | Checked background of root |
|
|
363
|
+
| radiobutton.checked.hover.background | --p-radiobutton-checked-hover-background | Checked hover background of root |
|
|
364
|
+
| radiobutton.disabled.background | --p-radiobutton-disabled-background | Disabled background of root |
|
|
365
|
+
| radiobutton.filled.background | --p-radiobutton-filled-background | Filled background of root |
|
|
366
|
+
| radiobutton.border.color | --p-radiobutton-border-color | Border color of root |
|
|
367
|
+
| radiobutton.hover.border.color | --p-radiobutton-hover-border-color | Hover border color of root |
|
|
368
|
+
| radiobutton.focus.border.color | --p-radiobutton-focus-border-color | Focus border color of root |
|
|
369
|
+
| radiobutton.checked.border.color | --p-radiobutton-checked-border-color | Checked border color of root |
|
|
370
|
+
| radiobutton.checked.hover.border.color | --p-radiobutton-checked-hover-border-color | Checked hover border color of root |
|
|
371
|
+
| radiobutton.checked.focus.border.color | --p-radiobutton-checked-focus-border-color | Checked focus border color of root |
|
|
372
|
+
| radiobutton.checked.disabled.border.color | --p-radiobutton-checked-disabled-border-color | Checked disabled border color of root |
|
|
373
|
+
| radiobutton.invalid.border.color | --p-radiobutton-invalid-border-color | Invalid border color of root |
|
|
374
|
+
| radiobutton.shadow | --p-radiobutton-shadow | Shadow of root |
|
|
375
|
+
| radiobutton.focus.ring.width | --p-radiobutton-focus-ring-width | Focus ring width of root |
|
|
376
|
+
| radiobutton.focus.ring.style | --p-radiobutton-focus-ring-style | Focus ring style of root |
|
|
377
|
+
| radiobutton.focus.ring.color | --p-radiobutton-focus-ring-color | Focus ring color of root |
|
|
378
|
+
| radiobutton.focus.ring.offset | --p-radiobutton-focus-ring-offset | Focus ring offset of root |
|
|
379
|
+
| radiobutton.focus.ring.shadow | --p-radiobutton-focus-ring-shadow | Focus ring shadow of root |
|
|
380
|
+
| radiobutton.transition.duration | --p-radiobutton-transition-duration | Transition duration of root |
|
|
381
|
+
| radiobutton.sm.width | --p-radiobutton-sm-width | Sm width of root |
|
|
382
|
+
| radiobutton.sm.height | --p-radiobutton-sm-height | Sm height of root |
|
|
383
|
+
| radiobutton.lg.width | --p-radiobutton-lg-width | Lg width of root |
|
|
384
|
+
| radiobutton.lg.height | --p-radiobutton-lg-height | Lg height of root |
|
|
385
|
+
| radiobutton.icon.size | --p-radiobutton-icon-size | Size of icon |
|
|
386
|
+
| radiobutton.icon.checked.color | --p-radiobutton-icon-checked-color | Checked color of icon |
|
|
387
|
+
| radiobutton.icon.checked.hover.color | --p-radiobutton-icon-checked-hover-color | Checked hover color of icon |
|
|
388
|
+
| radiobutton.icon.disabled.color | --p-radiobutton-icon-disabled-color | Disabled color of icon |
|
|
389
|
+
| radiobutton.icon.sm.size | --p-radiobutton-icon-sm-size | Sm size of icon |
|
|
390
|
+
| radiobutton.icon.lg.size | --p-radiobutton-icon-lg-size | Lg size of icon |
|
|
391
|
+
|
|
392
|
+
## Radio Button Group API
|
|
393
|
+
|
|
394
|
+
### Props
|
|
395
|
+
|
|
396
|
+
| Name |Type |Default |Description |
|
|
397
|
+
| --- | --- | --- | --- |
|
|
398
|
+
| modelValue | any | - | Value binding of the radiobuttons. |
|
|
399
|
+
| defaultValue | any | - | Default values of the radiobuttons in uncontrolled mode. |
|
|
400
|
+
| name | string | - | Name of the input elements. |
|
|
401
|
+
| invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
|
|
402
|
+
| formControl | any | - | Used to set form control options. |
|
|
403
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
404
|
+
| pt | PassThrough<RadioButtonGroupPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
405
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
406
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
407
|
+
|
|
408
|
+
### Slots
|
|
409
|
+
|
|
410
|
+
| Name |Parameters |Description |
|
|
411
|
+
| --- | --- | --- |
|
|
412
|
+
| default | Function | |
|
|
413
|
+
|
|
414
|
+
### Pass Through Options
|
|
415
|
+
|
|
416
|
+
| Name |Type |Description |
|
|
417
|
+
| --- | --- | --- |
|
|
418
|
+
| root | RadioButtonGroupPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
419
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
420
|
+
|
|
421
|
+
### Theming
|
|
422
|
+
|
|
423
|
+
### CSS Classes
|
|
424
|
+
|
|
425
|
+
| Class |Description |
|
|
426
|
+
| --- | --- |
|
|
427
|
+
| p-radiobutton-group | Class name of the root element |
|