@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,268 @@
|
|
|
1
|
+
# SelectButton
|
|
2
|
+
|
|
3
|
+
SelectButton is used to choose single or multiple items from a list using buttons.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
SelectButton requires a value to bind and a collection of options.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex justify-center">
|
|
12
|
+
<SelectButton v-model="value" :options="stateOptions" optionLabel="label" optionValue="value" aria-labelledby="basic" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { ref } from 'vue';
|
|
18
|
+
|
|
19
|
+
const value = ref('one-way');
|
|
20
|
+
const stateOptions = ref([
|
|
21
|
+
{ label: 'One-Way', value: 'one-way' },
|
|
22
|
+
{ label: 'Return', value: 'return' }
|
|
23
|
+
]);
|
|
24
|
+
<\/script>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Multiple
|
|
28
|
+
|
|
29
|
+
SelectButton allows selecting only one item by default and setting multiple option enables choosing more than one item. In multiple case, model property should be an array.
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<template>
|
|
33
|
+
<div class="flex justify-center">
|
|
34
|
+
<SelectButton v-model="value" :options="paymentOptions" optionLabel="name" optionValue="value" multiple />
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup>
|
|
39
|
+
import { ref } from 'vue';
|
|
40
|
+
|
|
41
|
+
const value = ref(null);
|
|
42
|
+
const paymentOptions = ref([
|
|
43
|
+
{ name: 'Option 1', value: 1 },
|
|
44
|
+
{ name: 'Option 2', value: 2 },
|
|
45
|
+
{ name: 'Option 3', value: 3 }
|
|
46
|
+
]);
|
|
47
|
+
<\/script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Template
|
|
51
|
+
|
|
52
|
+
For custom content support define an option template where the default slot props refer to an option.
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<template>
|
|
56
|
+
<div class="flex justify-center">
|
|
57
|
+
<SelectButton v-model="value" :options="justifyOptions" optionLabel="justify">
|
|
58
|
+
<template #option="{ icon }">
|
|
59
|
+
<component :is="icon" />
|
|
60
|
+
</template>
|
|
61
|
+
</SelectButton>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import { ref } from 'vue';
|
|
67
|
+
import AlignCenter from '@primeicons/vue/align-center';
|
|
68
|
+
import AlignJustify from '@primeicons/vue/align-justify';
|
|
69
|
+
import AlignLeft from '@primeicons/vue/align-left';
|
|
70
|
+
import AlignRight from '@primeicons/vue/align-right';
|
|
71
|
+
|
|
72
|
+
const value = ref(null);
|
|
73
|
+
const justifyOptions = ref([
|
|
74
|
+
{ icon: AlignLeft, justify: 'Left' },
|
|
75
|
+
{ icon: AlignRight, justify: 'Right' },
|
|
76
|
+
{ icon: AlignCenter, justify: 'Center' },
|
|
77
|
+
{ icon: AlignJustify, justify: 'Justify' }
|
|
78
|
+
]);
|
|
79
|
+
<\/script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Sizes
|
|
83
|
+
|
|
84
|
+
SelectButton provides small and large sizes as alternatives to the base.
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<template>
|
|
88
|
+
<div class="flex flex-col items-center gap-4">
|
|
89
|
+
<SelectButton v-model="value1" :options="options" size="small" />
|
|
90
|
+
<SelectButton v-model="value2" :options="options" />
|
|
91
|
+
<SelectButton v-model="value3" :options="options" size="large" />
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script setup>
|
|
96
|
+
import { ref } from 'vue';
|
|
97
|
+
|
|
98
|
+
const value1 = ref(null);
|
|
99
|
+
const value2 = ref('Beginner');
|
|
100
|
+
const value3 = ref('Expert');
|
|
101
|
+
const options = ref(['Beginner', 'Expert']);
|
|
102
|
+
<\/script>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Fluid
|
|
106
|
+
|
|
107
|
+
The fluid prop makes the component take up the full width of its container when set to true.
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<template>
|
|
111
|
+
<SelectButton v-model="value" :options="stateOptions" optionLabel="label" optionValue="value" fluid />
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script setup>
|
|
115
|
+
import { ref } from 'vue';
|
|
116
|
+
|
|
117
|
+
const value = ref('one-way');
|
|
118
|
+
const stateOptions = ref([
|
|
119
|
+
{ label: 'One-Way', value: 'one-way' },
|
|
120
|
+
{ label: 'Return', value: 'return' }
|
|
121
|
+
]);
|
|
122
|
+
<\/script>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Disabled
|
|
126
|
+
|
|
127
|
+
When disabled is present, the element cannot be edited and focused entirely. Certain options can also be disabled using the optionDisabled property.
|
|
128
|
+
|
|
129
|
+
```vue
|
|
130
|
+
<template>
|
|
131
|
+
<div class="flex justify-center flex-wrap gap-4">
|
|
132
|
+
<SelectButton v-model="value1" :options="stateOptions" optionLabel="label" optionValue="value" disabled />
|
|
133
|
+
<SelectButton v-model="value2" :options="stateOptions2" optionLabel="label" optionValue="value" optionDisabled="constant" />
|
|
134
|
+
</div>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<script setup>
|
|
138
|
+
import { ref } from 'vue';
|
|
139
|
+
|
|
140
|
+
const value1 = ref('off');
|
|
141
|
+
const value2 = ref('Option 1');
|
|
142
|
+
const stateOptions = ref([
|
|
143
|
+
{ label: 'Off', value: 'off' },
|
|
144
|
+
{ label: 'On', value: 'on' }
|
|
145
|
+
]);
|
|
146
|
+
const stateOptions2 = ref([
|
|
147
|
+
{ label: 'Option 1', value: 'Option 1' },
|
|
148
|
+
{ label: 'Option 2', value: 'Option 2', constant: true }
|
|
149
|
+
]);
|
|
150
|
+
<\/script>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Invalid
|
|
154
|
+
|
|
155
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation libraries.
|
|
156
|
+
|
|
157
|
+
```vue
|
|
158
|
+
<template>
|
|
159
|
+
<div class="flex justify-center">
|
|
160
|
+
<SelectButton v-model="value" :options="stateOptions" optionLabel="label" optionValue="value" :invalid="value == null" />
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|
|
163
|
+
|
|
164
|
+
<script setup>
|
|
165
|
+
import { ref } from 'vue';
|
|
166
|
+
|
|
167
|
+
const value = ref(undefined);
|
|
168
|
+
const stateOptions = ref([
|
|
169
|
+
{ label: 'One-Way', value: 'one-way' },
|
|
170
|
+
{ label: 'Return', value: 'return' }
|
|
171
|
+
]);
|
|
172
|
+
<\/script>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Forms
|
|
176
|
+
|
|
177
|
+
SelectButton integrates seamlessly with the PrimeVue Forms library.
|
|
178
|
+
|
|
179
|
+
```vue
|
|
180
|
+
<template>
|
|
181
|
+
<div class="flex justify-center">
|
|
182
|
+
<Form v-slot="$form" :resolver="resolver" :initialValues="initialValues" @submit="onFormSubmit" class="flex flex-col gap-4">
|
|
183
|
+
<div class="flex items-center flex-col gap-1">
|
|
184
|
+
<SelectButton name="selection" :options="options" />
|
|
185
|
+
<Message v-if="$form.selection?.invalid" severity="error" size="small" variant="simple">{{ $form.selection.error?.message }}</Message>
|
|
186
|
+
</div>
|
|
187
|
+
<Button type="submit" severity="secondary">Submit</Button>
|
|
188
|
+
</Form>
|
|
189
|
+
</div>
|
|
190
|
+
</template>
|
|
191
|
+
|
|
192
|
+
<script setup>
|
|
193
|
+
import { ref } from 'vue';
|
|
194
|
+
import { zodResolver } from '@primevue/forms/resolvers/zod';
|
|
195
|
+
import { useToast } from "primevue/usetoast";
|
|
196
|
+
import { z } from 'zod';
|
|
197
|
+
|
|
198
|
+
const toast = useToast();
|
|
199
|
+
const initialValues = ref({
|
|
200
|
+
selection: ''
|
|
201
|
+
});
|
|
202
|
+
const resolver = ref(zodResolver(
|
|
203
|
+
z.object({
|
|
204
|
+
selection: z.preprocess((val) => (val === null ? '' : val), z.string().min(1, { message: 'Selection is required' }))
|
|
205
|
+
})
|
|
206
|
+
));
|
|
207
|
+
|
|
208
|
+
const onFormSubmit = ({ valid }) => {
|
|
209
|
+
if (valid) {
|
|
210
|
+
toast.add({ severity: 'success', summary: 'Form is submitted.', life: 3000 });
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
<\/script>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Accessibility
|
|
217
|
+
|
|
218
|
+
Screen Reader The container element that wraps the buttons has a group role whereas each button element uses button role and aria-pressed is updated depending on selection state. Value to describe an option is automatically set using the ariaLabel property that refers to the label of an option so it is still suggested to define a label even the option display consists of presentational content like icons only. Keyboard Support Key Function tab Moves focus to the buttons. space Toggles the checked state of a button.
|
|
219
|
+
|
|
220
|
+
## Select Button API
|
|
221
|
+
|
|
222
|
+
### Props
|
|
223
|
+
|
|
224
|
+
| Name |Type |Default |Description |
|
|
225
|
+
| --- | --- | --- | --- |
|
|
226
|
+
| modelValue | any | - | Value of the component. |
|
|
227
|
+
| defaultValue | any | - | The default value for the input when not controlled by `modelValue` . |
|
|
228
|
+
| name | string | - | The name attribute for the element, typically used in form submissions. |
|
|
229
|
+
| options | any[] | - | An array of selectitems to display as the available options. |
|
|
230
|
+
| optionLabel | string \| Function | - | Property name or getter function to use as the label of an option. |
|
|
231
|
+
| optionValue | string \| Function | - | Property name or getter function to use as the value of an option, defaults to the option itself when not defined. |
|
|
232
|
+
| optionDisabled | string \| Function | - | Property name or getter function to use as the disabled flag of an option, defaults to false when not defined. |
|
|
233
|
+
| multiple | boolean | false | When specified, allows selecting multiple values. |
|
|
234
|
+
| invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
|
|
235
|
+
| disabled | boolean | false | When present, it specifies that the element should be disabled. |
|
|
236
|
+
| fluid | boolean | null | Spans 100% width of the container when enabled. |
|
|
237
|
+
| dataKey | string | - | A property to uniquely identify an option. |
|
|
238
|
+
| allowEmpty | boolean | true | Whether selection can be cleared. |
|
|
239
|
+
| ariaLabelledby | string | - | Identifier of the underlying element. |
|
|
240
|
+
| size | HintedString<"small" \| "large"> | - | Defines the size of the component. |
|
|
241
|
+
| formControl | Record<string, any> | - | Form control object, typically used for handling validation and form state. |
|
|
242
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
243
|
+
| pt | PassThrough<SelectButtonPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
244
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
245
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
246
|
+
|
|
247
|
+
### Pass Through Options
|
|
248
|
+
|
|
249
|
+
| Name |Type |Description |
|
|
250
|
+
| --- | --- | --- |
|
|
251
|
+
| root | SelectButtonPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
252
|
+
| pcToggleButton | SelectButtonPassThroughOptionType | Used to pass attributes to the ToggleButton component. |
|
|
253
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
254
|
+
|
|
255
|
+
### Theming
|
|
256
|
+
|
|
257
|
+
### CSS Classes
|
|
258
|
+
|
|
259
|
+
| Class |Description |
|
|
260
|
+
| --- | --- |
|
|
261
|
+
| p-selectbutton | Class name of the root element |
|
|
262
|
+
|
|
263
|
+
### Design Tokens
|
|
264
|
+
|
|
265
|
+
| Token |CSS Variable |Description |
|
|
266
|
+
| --- | --- | --- |
|
|
267
|
+
| selectbutton.border.radius | --p-selectbutton-border-radius | Border radius of root |
|
|
268
|
+
| selectbutton.invalid.border.color | --p-selectbutton-invalid-border-color | Invalid border color of root |
|