@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,551 @@
|
|
|
1
|
+
# InputNumber
|
|
2
|
+
|
|
3
|
+
InputNumber is an input component to provide numerical input.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
InputNumber is used with the v-model property for two-way value binding.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex items-center justify-center">
|
|
12
|
+
<InputNumber v-model="value" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { ref } from 'vue';
|
|
18
|
+
|
|
19
|
+
const value = ref(42723);
|
|
20
|
+
<\/script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Numerals
|
|
24
|
+
|
|
25
|
+
InputNumber supports decimal numbers with precision control.
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<template>
|
|
29
|
+
<Fluid class="flex flex-wrap gap-4">
|
|
30
|
+
<div class="flex-auto">
|
|
31
|
+
<Label class="font-bold! mb-2 block" for="integeronly">Integer Only</Label>
|
|
32
|
+
<InputNumber v-model="value1" inputId="integeronly" />
|
|
33
|
+
</div>
|
|
34
|
+
<div class="flex-auto">
|
|
35
|
+
<Label class="font-bold! mb-2 block" for="withoutgrouping">Without Grouping</Label>
|
|
36
|
+
<InputNumber v-model="value2" mode="decimal" inputId="withoutgrouping" :useGrouping="false" />
|
|
37
|
+
</div>
|
|
38
|
+
<div class="flex-auto">
|
|
39
|
+
<Label class="font-bold! mb-2 block" for="minmaxfraction">Min-Max Fraction Digits</Label>
|
|
40
|
+
<InputNumber v-model="value3" inputId="minmaxfraction" mode="decimal" :minFractionDigits="2" :maxFractionDigits="5" />
|
|
41
|
+
</div>
|
|
42
|
+
<div class="flex-auto">
|
|
43
|
+
<Label class="font-bold! mb-2 block" for="minmax">Min-Max Boundaries</Label>
|
|
44
|
+
<InputNumber v-model="value4" inputId="minmax" mode="decimal" :min="0" :max="100" />
|
|
45
|
+
</div>
|
|
46
|
+
</Fluid>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
50
|
+
import { ref } from 'vue';
|
|
51
|
+
|
|
52
|
+
const value1 = ref(42723);
|
|
53
|
+
const value2 = ref(58151);
|
|
54
|
+
const value3 = ref(2351.35);
|
|
55
|
+
const value4 = ref(50);
|
|
56
|
+
<\/script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Locale
|
|
60
|
+
|
|
61
|
+
Localization information such as grouping and decimal symbols are defined with the locale property which defaults to the user locale.
|
|
62
|
+
|
|
63
|
+
```vue
|
|
64
|
+
<template>
|
|
65
|
+
<Fluid class="flex flex-wrap gap-4">
|
|
66
|
+
<div class="flex-auto">
|
|
67
|
+
<Label class="font-bold! block mb-2" for="locale-user">User Locale</Label>
|
|
68
|
+
<InputNumber v-model="value1" inputId="locale-user" :minFractionDigits="2" />
|
|
69
|
+
</div>
|
|
70
|
+
<div class="flex-auto">
|
|
71
|
+
<Label class="font-bold! block mb-2" for="locale-us">United States Locale</Label>
|
|
72
|
+
<InputNumber v-model="value2" inputId="locale-us" mode="decimal" locale="en-US" :minFractionDigits="2" />
|
|
73
|
+
</div>
|
|
74
|
+
<div class="flex-auto">
|
|
75
|
+
<Label class="font-bold! block mb-2" for="locale-german">German Locale</Label>
|
|
76
|
+
<InputNumber v-model="value3" inputId="locale-german" mode="decimal" locale="de-DE" :minFractionDigits="2" />
|
|
77
|
+
</div>
|
|
78
|
+
<div class="flex-auto">
|
|
79
|
+
<Label class="font-bold! block mb-2" for="locale-indian">Indian Locale</Label>
|
|
80
|
+
<InputNumber v-model="value4" inputId="locale-indian" mode="decimal" locale="en-IN" :minFractionDigits="2" />
|
|
81
|
+
</div>
|
|
82
|
+
</Fluid>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup>
|
|
86
|
+
import { ref } from 'vue';
|
|
87
|
+
|
|
88
|
+
const value1 = ref(151351);
|
|
89
|
+
const value2 = ref(115744);
|
|
90
|
+
const value3 = ref(635524);
|
|
91
|
+
const value4 = ref(732762);
|
|
92
|
+
<\/script>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Currency
|
|
96
|
+
|
|
97
|
+
Monetary values are enabled by setting mode property as currency . In this setting, currency property also needs to be defined using ISO 4217 standard such as "USD" for the US dollar.
|
|
98
|
+
|
|
99
|
+
```vue
|
|
100
|
+
<template>
|
|
101
|
+
<Fluid class="flex flex-wrap gap-4">
|
|
102
|
+
<div class="flex-auto">
|
|
103
|
+
<Label class="font-bold! block mb-2" for="currency-us">United States</Label>
|
|
104
|
+
<InputNumber v-model="value1" inputId="currency-us" mode="currency" currency="USD" locale="en-US" />
|
|
105
|
+
</div>
|
|
106
|
+
<div class="flex-auto">
|
|
107
|
+
<Label class="font-bold! block mb-2" for="currency-germany">Germany</Label>
|
|
108
|
+
<InputNumber v-model="value2" mode="currency" inputId="currency-germany" currency="EUR" locale="de-DE" />
|
|
109
|
+
</div>
|
|
110
|
+
<div class="flex-auto">
|
|
111
|
+
<Label class="font-bold! block mb-2" for="currency-india">India</Label>
|
|
112
|
+
<InputNumber v-model="value3" mode="currency" inputId="currency-india" currency="INR" currencyDisplay="code" locale="en-IN" />
|
|
113
|
+
</div>
|
|
114
|
+
<div class="flex-auto">
|
|
115
|
+
<Label class="font-bold! block mb-2" for="currency-japan">Japan</Label>
|
|
116
|
+
<InputNumber v-model="value4" mode="currency" inputId="currency-japan" currency="JPY" locale="jp-JP" />
|
|
117
|
+
</div>
|
|
118
|
+
</Fluid>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<script setup>
|
|
122
|
+
import { ref } from 'vue';
|
|
123
|
+
|
|
124
|
+
const value1 = ref(1500);
|
|
125
|
+
const value2 = ref(2500);
|
|
126
|
+
const value3 = ref(4250);
|
|
127
|
+
const value4 = ref(5002);
|
|
128
|
+
<\/script>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Prefix & Suffix
|
|
132
|
+
|
|
133
|
+
Custom texts e.g. units can be placed before or after the input section with the prefix and suffix properties.
|
|
134
|
+
|
|
135
|
+
```vue
|
|
136
|
+
<template>
|
|
137
|
+
<Fluid class="flex flex-wrap gap-4">
|
|
138
|
+
<div class="flex-auto">
|
|
139
|
+
<Label class="font-bold! block mb-2" for="mile">Mile</Label>
|
|
140
|
+
<InputNumber v-model="value1" inputId="mile" suffix=" mi" />
|
|
141
|
+
</div>
|
|
142
|
+
<div class="flex-auto">
|
|
143
|
+
<Label class="font-bold! block mb-2" for="percent">Percent</Label>
|
|
144
|
+
<InputNumber v-model="value2" inputId="percent" prefix="%" />
|
|
145
|
+
</div>
|
|
146
|
+
<div class="flex-auto">
|
|
147
|
+
<Label class="font-bold! block mb-2" for="expiry">Expiry</Label>
|
|
148
|
+
<InputNumber v-model="value3" inputId="expiry" prefix="Expires in " suffix=" days" />
|
|
149
|
+
</div>
|
|
150
|
+
<div class="flex-auto">
|
|
151
|
+
<Label class="font-bold! block mb-2" for="temperature">Temperature</Label>
|
|
152
|
+
<InputNumber v-model="value4" prefix="↑ " inputId="temperature" suffix="℃" :min="0" :max="40" />
|
|
153
|
+
</div>
|
|
154
|
+
</Fluid>
|
|
155
|
+
</template>
|
|
156
|
+
|
|
157
|
+
<script setup>
|
|
158
|
+
import { ref } from 'vue';
|
|
159
|
+
|
|
160
|
+
const value1 = ref(20);
|
|
161
|
+
const value2 = ref(50);
|
|
162
|
+
const value3 = ref(10);
|
|
163
|
+
const value4 = ref(20);
|
|
164
|
+
<\/script>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Buttons
|
|
168
|
+
|
|
169
|
+
Spinner buttons are enabled using the showButtons property and layout is defined with the buttonLayout .
|
|
170
|
+
|
|
171
|
+
```vue
|
|
172
|
+
<template>
|
|
173
|
+
<Fluid class="flex flex-wrap gap-4">
|
|
174
|
+
<div class="flex-auto">
|
|
175
|
+
<Label class="font-bold! mb-2 block" for="stacked">Stacked</Label>
|
|
176
|
+
<InputNumber v-model="value1" showButtons inputId="stacked" mode="currency" currency="USD" />
|
|
177
|
+
</div>
|
|
178
|
+
<div class="flex-auto">
|
|
179
|
+
<Label class="font-bold! mb-2 block" for="minmax-buttons">Min-Max Boundaries</Label>
|
|
180
|
+
<InputNumber v-model="value2" mode="decimal" showButtons inputId="minmax-buttons" :min="0" :max="100" />
|
|
181
|
+
</div>
|
|
182
|
+
<div class="flex-auto">
|
|
183
|
+
<Label class="font-bold! mb-2 block" for="horizontal">Horizontal with Step</Label>
|
|
184
|
+
<InputNumber v-model="value3" showButtons buttonLayout="horizontal" inputId="horizontal" :step="0.25" mode="currency" currency="EUR">
|
|
185
|
+
<template #incrementicon>
|
|
186
|
+
<Plus />
|
|
187
|
+
</template>
|
|
188
|
+
<template #decrementicon>
|
|
189
|
+
<Minus />
|
|
190
|
+
</template>
|
|
191
|
+
</InputNumber>
|
|
192
|
+
</div>
|
|
193
|
+
</Fluid>
|
|
194
|
+
</template>
|
|
195
|
+
|
|
196
|
+
<script setup>
|
|
197
|
+
import { ref } from 'vue';
|
|
198
|
+
|
|
199
|
+
const value1 = ref(20);
|
|
200
|
+
const value2 = ref(10.5);
|
|
201
|
+
const value3 = ref(25);
|
|
202
|
+
<\/script>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Vertical
|
|
206
|
+
|
|
207
|
+
Buttons can also placed vertically by setting buttonLayout as vertical .
|
|
208
|
+
|
|
209
|
+
```vue
|
|
210
|
+
<template>
|
|
211
|
+
<div class="flex justify-center">
|
|
212
|
+
<InputNumber v-model="value" showButtons buttonLayout="vertical" inputId="vertical" :inputStyle="{ width: '3rem' }">
|
|
213
|
+
<template #incrementicon>
|
|
214
|
+
<Plus />
|
|
215
|
+
</template>
|
|
216
|
+
<template #decrementicon>
|
|
217
|
+
<Minus />
|
|
218
|
+
</template>
|
|
219
|
+
</InputNumber>
|
|
220
|
+
</div>
|
|
221
|
+
</template>
|
|
222
|
+
|
|
223
|
+
<script setup>
|
|
224
|
+
import Minus from '@primeicons/vue/minus';
|
|
225
|
+
import Plus from '@primeicons/vue/plus';
|
|
226
|
+
import { ref } from 'vue';
|
|
227
|
+
|
|
228
|
+
const value = ref(50);
|
|
229
|
+
<\/script>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Float Label
|
|
233
|
+
|
|
234
|
+
A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
|
|
235
|
+
|
|
236
|
+
```vue
|
|
237
|
+
<template>
|
|
238
|
+
<div class="flex flex-wrap justify-center items-end gap-4">
|
|
239
|
+
<FloatLabel>
|
|
240
|
+
<InputNumber v-model="value1" inputId="over_label" mode="currency" currency="USD" locale="en-US" />
|
|
241
|
+
<label for="over_label">Over Label</label>
|
|
242
|
+
</FloatLabel>
|
|
243
|
+
|
|
244
|
+
<FloatLabel variant="in">
|
|
245
|
+
<InputNumber v-model="value2" inputId="in_label" mode="currency" currency="USD" locale="en-US" variant="filled" />
|
|
246
|
+
<label for="in_label">In Label</label>
|
|
247
|
+
</FloatLabel>
|
|
248
|
+
|
|
249
|
+
<FloatLabel variant="on">
|
|
250
|
+
<InputNumber v-model="value3" inputId="on_label" mode="currency" currency="USD" locale="en-US" />
|
|
251
|
+
<label for="on_label">On Label</label>
|
|
252
|
+
</FloatLabel>
|
|
253
|
+
</div>
|
|
254
|
+
</template>
|
|
255
|
+
|
|
256
|
+
<script setup>
|
|
257
|
+
import { ref } from "vue";
|
|
258
|
+
|
|
259
|
+
const value1 = ref(null);
|
|
260
|
+
const value2 = ref(null);
|
|
261
|
+
const value3 = ref(null);
|
|
262
|
+
<\/script>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Ifta Label
|
|
266
|
+
|
|
267
|
+
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
|
|
268
|
+
|
|
269
|
+
```vue
|
|
270
|
+
<template>
|
|
271
|
+
<div class="flex justify-center">
|
|
272
|
+
<IftaLabel>
|
|
273
|
+
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" variant="filled" />
|
|
274
|
+
<label for="price_input">Price</label>
|
|
275
|
+
</IftaLabel>
|
|
276
|
+
</div>
|
|
277
|
+
</template>
|
|
278
|
+
|
|
279
|
+
<script setup>
|
|
280
|
+
import { ref } from "vue";
|
|
281
|
+
|
|
282
|
+
const value = ref(1);
|
|
283
|
+
<\/script>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Clear Icon
|
|
287
|
+
|
|
288
|
+
When showClear is enabled, a clear icon is displayed to clear the value.
|
|
289
|
+
|
|
290
|
+
```vue
|
|
291
|
+
<template>
|
|
292
|
+
<div class="flex justify-center">
|
|
293
|
+
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" showClear inputClass="w-56" />
|
|
294
|
+
</div>
|
|
295
|
+
</template>
|
|
296
|
+
|
|
297
|
+
<script setup>
|
|
298
|
+
import { ref } from 'vue';
|
|
299
|
+
|
|
300
|
+
const value = ref(null);
|
|
301
|
+
<\/script>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## Sizes
|
|
305
|
+
|
|
306
|
+
InputNumber provides small and large sizes as alternatives to the base.
|
|
307
|
+
|
|
308
|
+
```vue
|
|
309
|
+
<template>
|
|
310
|
+
<div class="flex flex-col items-center gap-4">
|
|
311
|
+
<InputNumber v-model="value1" size="small" placeholder="Small" mode="currency" currency="USD" locale="en-US" />
|
|
312
|
+
<InputNumber v-model="value2" placeholder="Normal" mode="currency" currency="USD" locale="en-US" />
|
|
313
|
+
<InputNumber v-model="value3" size="large" placeholder="Large" mode="currency" currency="USD" locale="en-US" />
|
|
314
|
+
</div>
|
|
315
|
+
</template>
|
|
316
|
+
|
|
317
|
+
<script setup>
|
|
318
|
+
import { ref } from 'vue';
|
|
319
|
+
|
|
320
|
+
const value1 = ref(null);
|
|
321
|
+
const value2 = ref(null);
|
|
322
|
+
const value3 = ref(null);
|
|
323
|
+
<\/script>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Fluid
|
|
327
|
+
|
|
328
|
+
The fluid prop makes the component take up the full width of its container when set to true.
|
|
329
|
+
|
|
330
|
+
```vue
|
|
331
|
+
<template>
|
|
332
|
+
<InputNumber v-model="value" inputId="price_input" mode="currency" currency="USD" locale="en-US" fluid />
|
|
333
|
+
</template>
|
|
334
|
+
|
|
335
|
+
<script setup>
|
|
336
|
+
import { ref } from 'vue';
|
|
337
|
+
|
|
338
|
+
const value = ref(null);
|
|
339
|
+
<\/script>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Filled
|
|
343
|
+
|
|
344
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
345
|
+
|
|
346
|
+
```vue
|
|
347
|
+
<template>
|
|
348
|
+
<div class="flex justify-center">
|
|
349
|
+
<InputNumber v-model="value" variant="filled" />
|
|
350
|
+
</div>
|
|
351
|
+
</template>
|
|
352
|
+
|
|
353
|
+
<script setup>
|
|
354
|
+
import { ref } from "vue";
|
|
355
|
+
|
|
356
|
+
const value = ref();
|
|
357
|
+
<\/script>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Disabled
|
|
361
|
+
|
|
362
|
+
When disabled is present, the element cannot be edited and focused.
|
|
363
|
+
|
|
364
|
+
```vue
|
|
365
|
+
<template>
|
|
366
|
+
<div class="flex justify-center">
|
|
367
|
+
<InputNumber v-model="value" inputId="integeronly" disabled prefix="%" />
|
|
368
|
+
</div>
|
|
369
|
+
</template>
|
|
370
|
+
|
|
371
|
+
<script setup>
|
|
372
|
+
import { ref } from 'vue';
|
|
373
|
+
|
|
374
|
+
const value = ref(50);
|
|
375
|
+
<\/script>
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Invalid
|
|
379
|
+
|
|
380
|
+
The invalid state is applied using the invalid property to indicate failed validation, which can be integrated with form validation libraries.
|
|
381
|
+
|
|
382
|
+
```vue
|
|
383
|
+
<template>
|
|
384
|
+
<div class="flex flex-wrap justify-center gap-4">
|
|
385
|
+
<InputNumber v-model="value1" :invalid="value1 === null" mode="decimal" :minFractionDigits="2" placeholder="Amount" />
|
|
386
|
+
<InputNumber v-model="value2" :invalid="value2 === null" mode="decimal" :minFractionDigits="2" variant="filled" placeholder="Amount" />
|
|
387
|
+
</div>
|
|
388
|
+
</template>
|
|
389
|
+
|
|
390
|
+
<script setup>
|
|
391
|
+
import { ref } from 'vue';
|
|
392
|
+
|
|
393
|
+
const value1 = ref(null);
|
|
394
|
+
const value2 = ref(null);
|
|
395
|
+
<\/script>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
## Forms
|
|
399
|
+
|
|
400
|
+
InputNumber integrates seamlessly with the PrimeVue Forms library.
|
|
401
|
+
|
|
402
|
+
```vue
|
|
403
|
+
<template>
|
|
404
|
+
<div class="flex justify-center">
|
|
405
|
+
<Form v-slot="$form" :resolver="resolver" :initialValues="initialValues" @submit="onFormSubmit" class="flex flex-col gap-4 w-full sm:w-56">
|
|
406
|
+
<div class="flex flex-col gap-1">
|
|
407
|
+
<InputNumber name="amount" fluid />
|
|
408
|
+
<Message v-if="$form.amount?.invalid" severity="error" size="small" variant="simple">{{ $form.amount.error?.message }}</Message>
|
|
409
|
+
</div>
|
|
410
|
+
<Button type="submit" severity="secondary">Submit</Button>
|
|
411
|
+
</Form>
|
|
412
|
+
</div>
|
|
413
|
+
</template>
|
|
414
|
+
|
|
415
|
+
<script setup>
|
|
416
|
+
import { ref } from 'vue';
|
|
417
|
+
import { zodResolver } from '@primevue/forms/resolvers/zod';
|
|
418
|
+
import { useToast } from "primevue/usetoast";
|
|
419
|
+
import { z } from 'zod';
|
|
420
|
+
|
|
421
|
+
const toast = useToast();
|
|
422
|
+
const initialValues = ref({
|
|
423
|
+
amount: null
|
|
424
|
+
});
|
|
425
|
+
const resolver = ref(zodResolver(
|
|
426
|
+
z.object({
|
|
427
|
+
amount: z.union([z.number().gt(0, { message: 'Must be greater than 0.' }).lt(10, { message: 'Must be less than 10.' }), z.literal(null)]).refine((val) => val !== null, { message: 'Number is required.' })
|
|
428
|
+
})
|
|
429
|
+
));
|
|
430
|
+
|
|
431
|
+
const onFormSubmit = ({ valid }) => {
|
|
432
|
+
if (valid) {
|
|
433
|
+
toast.add({ severity: 'success', summary: 'Form is submitted.', life: 3000 });
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
<\/script>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Accessibility
|
|
440
|
+
|
|
441
|
+
Screen Reader Value to describe the component can either be provided via label tag combined with inputId prop or using aria-labelledby , aria-label , aria-describedby props. The input element uses spinbutton role in addition to the aria-valuemin , aria-valuemax and aria-valuenow attributes. Keyboard Support Key Function tab Moves focus to the input. up arrow Increments the value. down arrow Decrements the value. home Set the minimum value if provided. end Set the maximum value if provided.
|
|
442
|
+
|
|
443
|
+
```vue
|
|
444
|
+
<template>
|
|
445
|
+
<label for="price">Price</label>
|
|
446
|
+
<InputNumber inputId="price" />
|
|
447
|
+
|
|
448
|
+
<span id="label_number">Number</span>
|
|
449
|
+
<InputNumber aria-labelledby="label_number" />
|
|
450
|
+
|
|
451
|
+
<InputNumber aria-label="Number" />
|
|
452
|
+
|
|
453
|
+
<InputNumber aria-describedby="describe" />
|
|
454
|
+
<small id="describe">Information</small>
|
|
455
|
+
</template>
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
## Input Number API
|
|
459
|
+
|
|
460
|
+
### Props
|
|
461
|
+
|
|
462
|
+
| Name |Type |Default |Description |
|
|
463
|
+
| --- | --- | --- | --- |
|
|
464
|
+
| modelValue | Nullable<number> | - | Value of the component. |
|
|
465
|
+
| defaultValue | Nullable<number> | - | The default value for the input when not controlled by `modelValue` . |
|
|
466
|
+
| name | string | - | The name attribute for the element, typically used in form submissions. |
|
|
467
|
+
| format | boolean | true | Whether to format the value. |
|
|
468
|
+
| showButtons | boolean | false | Displays spinner buttons. |
|
|
469
|
+
| buttonLayout | HintedString<"horizontal" \| "vertical" \| "stacked"> | stacked | Layout of the buttons. |
|
|
470
|
+
| incrementButtonClass | string | - | Style class of the increment button. |
|
|
471
|
+
| decrementButtonClass | string | - | Style class of the decrement button. |
|
|
472
|
+
| incrementIcon | string | - | Style class of the increment icon. |
|
|
473
|
+
| decrementIcon | string | - | Style class of the decrement icon. |
|
|
474
|
+
| locale | string | - | Locale to be used in formatting. |
|
|
475
|
+
| localeMatcher | HintedString<"lookup" \| "best fit"> | best fit | The locale matching algorithm to use. Possible values are 'lookup' and 'best fit'; the default is 'best fit'. See [Locale Negotation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_negotiation) for details. |
|
|
476
|
+
| mode | HintedString<"decimal" \| "currency"> | decimal | Defines the behavior of the component. |
|
|
477
|
+
| prefix | string | - | Text to display before the value. |
|
|
478
|
+
| suffix | string | - | Text to display after the value. |
|
|
479
|
+
| currency | string | - | The currency to use in currency formatting. Possible values are the [ISO 4217 currency codes](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency), such as 'USD' for the US dollar, 'EUR' for the euro, or 'CNY' for the Chinese RMB. There is no default value; if the style is 'currency', the currency property must be provided. |
|
|
480
|
+
| currencyDisplay | string | symbol | How to display the currency in currency formatting. Possible values are 'symbol' to use a localized currency symbol such as €, 'code' to use the ISO currency code, 'name' to use a localized currency name such as 'dollar'. |
|
|
481
|
+
| useGrouping | boolean | true | Whether to use grouping separators, such as thousands separators or thousand/lakh/crore separators. |
|
|
482
|
+
| minFractionDigits | number | - | The minimum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number and percent formatting is 0; the default for currency formatting is the number of minor unit digits provided by the [ISO 4217 currency code](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency) list (2 if the list doesn't provide that information). |
|
|
483
|
+
| maxFractionDigits | number | - | The maximum number of fraction digits to use. Possible values are from 0 to 20; the default for plain number formatting is the larger of minimumFractionDigits and 3; the default for currency formatting is the larger of minimumFractionDigits and the number of minor unit digits provided by the [ISO 4217 currency code](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency) list (2 if the list doesn't provide that information). |
|
|
484
|
+
| roundingMode | RoundingMode | - | How decimals should be rounded. The default value is `"halfExpand"` , [further information](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#roundingmode). |
|
|
485
|
+
| min | number | - | Minimum boundary value. |
|
|
486
|
+
| max | number | - | Maximum boundary value. |
|
|
487
|
+
| step | number | 1 | Step factor to increment/decrement the value. |
|
|
488
|
+
| allowEmpty | boolean | true | Determines whether the input field is empty. |
|
|
489
|
+
| highlightOnFocus | boolean | false | Highlights automatically the input value. |
|
|
490
|
+
| showClear | boolean | false | When enabled, a clear icon is displayed to clear the value. |
|
|
491
|
+
| size | HintedString<"small" \| "large"> | - | Defines the size of the component. |
|
|
492
|
+
| invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
|
|
493
|
+
| disabled | boolean | false | When present, it specifies that the component should be disabled. |
|
|
494
|
+
| variant | null \| HintedString<"outlined" \| "filled"> | null | Specifies the input variant of the component. |
|
|
495
|
+
| readonly | boolean | false | When present, it specifies that an input field is read-only. |
|
|
496
|
+
| placeholder | string | - | Placeholder text for the input. |
|
|
497
|
+
| fluid | boolean | null | Spans 100% width of the container when enabled. |
|
|
498
|
+
| inputId | string | - | Identifier of the focus input to match a label defined for the chips. |
|
|
499
|
+
| inputClass | string \| object | - | Style class of the input field. |
|
|
500
|
+
| inputStyle | object | - | Inline style of the input field. |
|
|
501
|
+
| ariaLabelledby | string | - | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
|
|
502
|
+
| ariaLabel | string | - | Establishes a string value that labels the component. |
|
|
503
|
+
| formControl | Record<string, any> | - | Form control object, typically used for handling validation and form state. |
|
|
504
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
505
|
+
| pt | PassThrough<InputNumberPassThroughOptions<any>> | - | Used to pass attributes to DOM elements inside the component. |
|
|
506
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
507
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
508
|
+
|
|
509
|
+
### Pass Through Options
|
|
510
|
+
|
|
511
|
+
| Name |Type |Description |
|
|
512
|
+
| --- | --- | --- |
|
|
513
|
+
| root | InputNumberPassThroughOptionType<T> | Used to pass attributes to the root's DOM element. |
|
|
514
|
+
| pcInputText | any | Used to pass attributes to the InputText component. |
|
|
515
|
+
| clearIcon | InputNumberPassThroughOptionType<T> | Used to pass attributes to the label's DOM element. |
|
|
516
|
+
| buttonGroup | InputNumberPassThroughOptionType<T> | Used to pass attributes to the button group's DOM element. |
|
|
517
|
+
| incrementButton | InputNumberPassThroughOptionType<T> | Used to pass attributes to the increment button's DOM element. |
|
|
518
|
+
| incrementIcon | InputNumberPassThroughOptionType<T> | Used to pass attributes to the increment icon's DOM element. |
|
|
519
|
+
| decrementButton | InputNumberPassThroughOptionType<T> | Used to pass attributes to the decrement button's DOM element. |
|
|
520
|
+
| decrementIcon | InputNumberPassThroughOptionType<T> | Used to pass attributes to the decrement icon's DOM element. |
|
|
521
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
522
|
+
|
|
523
|
+
### Theming
|
|
524
|
+
|
|
525
|
+
### CSS Classes
|
|
526
|
+
|
|
527
|
+
| Class |Description |
|
|
528
|
+
| --- | --- |
|
|
529
|
+
| p-inputnumber | Class name of the root element |
|
|
530
|
+
| p-inputnumber-input | Class name of the input element |
|
|
531
|
+
| p-inputnumber-button-group | Class name of the button group element |
|
|
532
|
+
| p-inputnumber-increment-button | Class name of the increment button element |
|
|
533
|
+
| p-inputnumber-decrement-button | Class name of the decrement button element |
|
|
534
|
+
|
|
535
|
+
### Design Tokens
|
|
536
|
+
|
|
537
|
+
| Token |CSS Variable |Description |
|
|
538
|
+
| --- | --- | --- |
|
|
539
|
+
| inputnumber.transition.duration | --p-inputnumber-transition-duration | Transition duration of root |
|
|
540
|
+
| inputnumber.button.width | --p-inputnumber-button-width | Width of button |
|
|
541
|
+
| inputnumber.button.border.radius | --p-inputnumber-button-border-radius | Border radius of button |
|
|
542
|
+
| inputnumber.button.vertical.padding | --p-inputnumber-button-vertical-padding | Vertical padding of button |
|
|
543
|
+
| inputnumber.button.background | --p-inputnumber-button-background | Background of button |
|
|
544
|
+
| inputnumber.button.hover.background | --p-inputnumber-button-hover-background | Hover background of button |
|
|
545
|
+
| inputnumber.button.active.background | --p-inputnumber-button-active-background | Active background of button |
|
|
546
|
+
| inputnumber.button.border.color | --p-inputnumber-button-border-color | Border color of button |
|
|
547
|
+
| inputnumber.button.hover.border.color | --p-inputnumber-button-hover-border-color | Hover border color of button |
|
|
548
|
+
| inputnumber.button.active.border.color | --p-inputnumber-button-active-border-color | Active border color of button |
|
|
549
|
+
| inputnumber.button.color | --p-inputnumber-button-color | Color of button |
|
|
550
|
+
| inputnumber.button.hover.color | --p-inputnumber-button-hover-color | Hover color of button |
|
|
551
|
+
| inputnumber.button.active.color | --p-inputnumber-button-active-color | Active color of button |
|