@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,964 @@
|
|
|
1
|
+
# DatePicker
|
|
2
|
+
|
|
3
|
+
DatePicker is a form component to work with dates.
|
|
4
|
+
|
|
5
|
+
## Basic
|
|
6
|
+
|
|
7
|
+
Select a single date from an interactive calendar popup.
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<div class="flex justify-center">
|
|
12
|
+
<DatePicker v-model="date" />
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup>
|
|
17
|
+
import { ref } from "vue";
|
|
18
|
+
|
|
19
|
+
const date = ref();
|
|
20
|
+
<\/script>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Format
|
|
24
|
+
|
|
25
|
+
Default date format is mm/dd/yy which can be customized using the dateFormat property. Following options can be a part of the format. d - day of month (no leading zero) dd - day of month (two digit) o - day of the year (no leading zeros) oo - day of the year (three digit) D - day name short DD - day name long m - month of year (no leading zero) mm - month of year (two digit) M - month name short MM - month name long y - year (two digit) yy - year (four digit) @ - Unix timestamp (ms since 01/01/1970) ! - Windows ticks (100ns since 01/01/0001) '...' - literal text '' - single quote anything else - literal text
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<template>
|
|
29
|
+
<div class="flex justify-center">
|
|
30
|
+
<DatePicker v-model="date" dateFormat="dd/mm/yy" />
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
import { ref } from "vue";
|
|
36
|
+
|
|
37
|
+
const date = ref();
|
|
38
|
+
<\/script>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Mask
|
|
42
|
+
|
|
43
|
+
DatePicker can be used with the v-mask directive to enforce a specific input format.
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<template>
|
|
47
|
+
<div class="flex justify-center">
|
|
48
|
+
<DatePicker v-model="date" dateFormat="dd/mm/yy" placeholder="dd/mm/yyyy" v-mask="'99/99/9999'" />
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { ref } from 'vue';
|
|
54
|
+
|
|
55
|
+
const date = ref();
|
|
56
|
+
<\/script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Locale
|
|
60
|
+
|
|
61
|
+
Locale for different languages and formats is defined globally, refer to the PrimeVue Locale configuration for more information.
|
|
62
|
+
|
|
63
|
+
## Icon
|
|
64
|
+
|
|
65
|
+
An additional icon is displayed next to the input field when showIcon is present.
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<template>
|
|
69
|
+
<div class="flex flex-wrap gap-4">
|
|
70
|
+
<div class="flex-auto">
|
|
71
|
+
<label for="buttondisplay" class="text-sm font-bold block mb-2"> Button </label>
|
|
72
|
+
<DatePicker v-model="buttondisplay" showIcon fluid :showOnFocus="false" inputId="buttondisplay" />
|
|
73
|
+
</div>
|
|
74
|
+
<div class="flex-auto">
|
|
75
|
+
<label for="icondisplay" class="text-sm font-bold block mb-2"> Default Icon </label>
|
|
76
|
+
<DatePicker v-model="icondisplay" showIcon fluid iconDisplay="input" inputId="icondisplay" />
|
|
77
|
+
</div>
|
|
78
|
+
<div class="flex-auto">
|
|
79
|
+
<label for="templatedisplay" class="text-sm font-bold block mb-2"> Custom Icon </label>
|
|
80
|
+
<DatePicker v-model="templatedisplay" showIcon fluid iconDisplay="input" timeOnly inputId="templatedisplay">
|
|
81
|
+
<template #inputicon="slotProps">
|
|
82
|
+
<Clock @click="slotProps.clickCallback" />
|
|
83
|
+
</template>
|
|
84
|
+
</DatePicker>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<script setup>
|
|
90
|
+
import { ref } from "vue";
|
|
91
|
+
import Clock from '@primeicons/vue/clock';
|
|
92
|
+
|
|
93
|
+
const buttondisplay = ref();
|
|
94
|
+
const icondisplay = ref();
|
|
95
|
+
const templatedisplay = ref();
|
|
96
|
+
<\/script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Min / Max
|
|
100
|
+
|
|
101
|
+
Boundaries for the permitted dates that can be entered are defined with minDate and maxDate properties.
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<template>
|
|
105
|
+
<div class="flex justify-center">
|
|
106
|
+
<DatePicker v-model="date" :minDate="minDate" :maxDate="maxDate" :manualInput="false" />
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<script setup>
|
|
111
|
+
import { ref } from "vue";
|
|
112
|
+
|
|
113
|
+
let today = new Date();
|
|
114
|
+
let month = today.getMonth();
|
|
115
|
+
let year = today.getFullYear();
|
|
116
|
+
let prevMonth = (month === 0) ? 11 : month -1;
|
|
117
|
+
let prevYear = (prevMonth === 11) ? year - 1 : year;
|
|
118
|
+
let nextMonth = (month === 11) ? 0 : month + 1;
|
|
119
|
+
let nextYear = (nextMonth === 0) ? year + 1 : year;
|
|
120
|
+
|
|
121
|
+
const date = ref();
|
|
122
|
+
const minDate = ref(new Date());
|
|
123
|
+
const maxDate = ref(new Date());
|
|
124
|
+
|
|
125
|
+
minDate.value.setMonth(prevMonth);
|
|
126
|
+
minDate.value.setFullYear(prevYear);
|
|
127
|
+
maxDate.value.setMonth(nextMonth);
|
|
128
|
+
maxDate.value.setFullYear(nextYear);
|
|
129
|
+
<\/script>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Multiple
|
|
133
|
+
|
|
134
|
+
In order to choose multiple dates, set selectionMode as multiple . In this mode, the value binding should be an array.
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<template>
|
|
138
|
+
<div class="flex justify-center">
|
|
139
|
+
<DatePicker v-model="dates" selectionMode="multiple" :manualInput="false" />
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
|
|
143
|
+
<script setup>
|
|
144
|
+
import { ref } from "vue";
|
|
145
|
+
|
|
146
|
+
const dates = ref();
|
|
147
|
+
<\/script>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Range
|
|
151
|
+
|
|
152
|
+
A range of dates can be selected by defining selectionMode as range , in this case the bound value would be an array with two values where first date is the start of the range and second date is the end.
|
|
153
|
+
|
|
154
|
+
```vue
|
|
155
|
+
<template>
|
|
156
|
+
<div class="flex justify-center">
|
|
157
|
+
<DatePicker v-model="dates" selectionMode="range" :manualInput="false" />
|
|
158
|
+
</div>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<script setup>
|
|
162
|
+
import { ref } from "vue";
|
|
163
|
+
|
|
164
|
+
const dates = ref();
|
|
165
|
+
<\/script>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Button Bar
|
|
169
|
+
|
|
170
|
+
When showButtonBar is present, today and clear buttons are displayed at the footer. The content can be fully customized with the buttonbar slot as well.
|
|
171
|
+
|
|
172
|
+
```vue
|
|
173
|
+
<template>
|
|
174
|
+
<div class="flex justify-center gap-4 flex-wrap">
|
|
175
|
+
<DatePicker v-model="date" showButtonBar placeholder="Basic" />
|
|
176
|
+
<DatePicker v-model="dates" showButtonBar placeholder="Customized" selectionMode="range" :manualInput="false">
|
|
177
|
+
<template #buttonbar="{ todayCallback, clearCallback }">
|
|
178
|
+
<div class="flex justify-between w-full">
|
|
179
|
+
<div class="flex gap-2">
|
|
180
|
+
<Button size="small" severity="secondary">Exact</Button>
|
|
181
|
+
<Button size="small" severity="secondary">Flexible</Button>
|
|
182
|
+
</div>
|
|
183
|
+
<div class="flex gap-2">
|
|
184
|
+
<Button size="small" @click="todayCallback" variant="outlined">Today</Button>
|
|
185
|
+
<Button size="small" severity="danger" variant="text" @click="clearCallback">
|
|
186
|
+
<Times />
|
|
187
|
+
</Button>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</template>
|
|
191
|
+
</DatePicker>
|
|
192
|
+
</div>
|
|
193
|
+
</template>
|
|
194
|
+
|
|
195
|
+
<script setup>
|
|
196
|
+
import { ref } from "vue";
|
|
197
|
+
import Times from '@primeicons/vue/times';
|
|
198
|
+
|
|
199
|
+
const date = ref();
|
|
200
|
+
const dates = ref();
|
|
201
|
+
<\/script>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Time
|
|
205
|
+
|
|
206
|
+
A time picker is displayed when showTime is enabled where 12/24 hour format is configured with hourFormat property. In case, only time needs to be selected, add timeOnly to hide the date section.
|
|
207
|
+
|
|
208
|
+
```vue
|
|
209
|
+
<template>
|
|
210
|
+
<div class="flex flex-wrap gap-4">
|
|
211
|
+
<div class="flex-auto">
|
|
212
|
+
<label for="datepicker-12h" class="text-sm font-bold block mb-2"> 12h Format </label>
|
|
213
|
+
<DatePicker id="datepicker-12h" v-model="datetime12h" showTime hourFormat="12" fluid />
|
|
214
|
+
</div>
|
|
215
|
+
<div class="flex-auto">
|
|
216
|
+
<label for="datepicker-24h" class="text-sm font-bold block mb-2"> 24h Format </label>
|
|
217
|
+
<DatePicker id="datepicker-24h" v-model="datetime24h" showTime hourFormat="24" fluid />
|
|
218
|
+
</div>
|
|
219
|
+
<div class="flex-auto">
|
|
220
|
+
<label for="datepicker-timeonly" class="text-sm font-bold block mb-2"> Time Only </label>
|
|
221
|
+
<DatePicker id="datepicker-timeonly" v-model="time" timeOnly fluid />
|
|
222
|
+
</div>
|
|
223
|
+
</div>
|
|
224
|
+
</template>
|
|
225
|
+
|
|
226
|
+
<script setup>
|
|
227
|
+
import { ref } from "vue";
|
|
228
|
+
|
|
229
|
+
const datetime12h = ref();
|
|
230
|
+
const datetime24h = ref();
|
|
231
|
+
const time = ref();
|
|
232
|
+
<\/script>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Month Picker
|
|
236
|
+
|
|
237
|
+
Month only picker is enabled by specifying view as month in addition to a suitable dateFormat .
|
|
238
|
+
|
|
239
|
+
```vue
|
|
240
|
+
<template>
|
|
241
|
+
<div class="flex justify-center">
|
|
242
|
+
<DatePicker v-model="date" view="month" dateFormat="mm/yy" :manualInput="false" />
|
|
243
|
+
</div>
|
|
244
|
+
</template>
|
|
245
|
+
|
|
246
|
+
<script setup>
|
|
247
|
+
import { ref } from "vue";
|
|
248
|
+
|
|
249
|
+
const date = ref();
|
|
250
|
+
<\/script>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Year Picker
|
|
254
|
+
|
|
255
|
+
Specifying view as year in addition to a suitable dateFormat enables the year picker.
|
|
256
|
+
|
|
257
|
+
```vue
|
|
258
|
+
<template>
|
|
259
|
+
<div class="flex justify-center">
|
|
260
|
+
<DatePicker v-model="date" view="year" dateFormat="yy" />
|
|
261
|
+
</div>
|
|
262
|
+
</template>
|
|
263
|
+
|
|
264
|
+
<script setup>
|
|
265
|
+
import { ref } from "vue";
|
|
266
|
+
|
|
267
|
+
const date = ref();
|
|
268
|
+
<\/script>
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Multiple Months
|
|
272
|
+
|
|
273
|
+
Number of months to display is configured with the numberOfMonths property.
|
|
274
|
+
|
|
275
|
+
```vue
|
|
276
|
+
<template>
|
|
277
|
+
<div class="flex justify-center">
|
|
278
|
+
<DatePicker v-model="date" :numberOfMonths="2" />
|
|
279
|
+
</div>
|
|
280
|
+
</template>
|
|
281
|
+
|
|
282
|
+
<script setup>
|
|
283
|
+
import { ref } from "vue";
|
|
284
|
+
|
|
285
|
+
const date = ref();
|
|
286
|
+
<\/script>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Model Type
|
|
290
|
+
|
|
291
|
+
The updateModelType property controls the data type of the value. When set to string it returns a string representation of the date, when set to date (default) it returns a Date object.
|
|
292
|
+
|
|
293
|
+
```vue
|
|
294
|
+
<template>
|
|
295
|
+
<div class="flex flex-wrap gap-4">
|
|
296
|
+
<div class="flex-auto">
|
|
297
|
+
<label for="datetype" class="text-sm font-bold block mb-2"> Date Type Model </label>
|
|
298
|
+
<DatePicker v-model="dateTypeModel" fluid />
|
|
299
|
+
</div>
|
|
300
|
+
<div class="flex-auto">
|
|
301
|
+
<label for="stringtype" class="text-sm font-bold block mb-2"> String Type Model </label>
|
|
302
|
+
<DatePicker v-model="stringTypeModel" updateModelType="string" fluid />
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</template>
|
|
306
|
+
|
|
307
|
+
<script setup>
|
|
308
|
+
import { ref } from "vue";
|
|
309
|
+
|
|
310
|
+
const dateTypeModel = ref();
|
|
311
|
+
const stringTypeModel = ref();
|
|
312
|
+
<\/script>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Date Template
|
|
316
|
+
|
|
317
|
+
Custom content can be placed inside date cells with the date slot that takes a date metadata object as a parameter.
|
|
318
|
+
|
|
319
|
+
```vue
|
|
320
|
+
<template>
|
|
321
|
+
<div class="flex justify-center">
|
|
322
|
+
<DatePicker v-model="date" :pt="{ day: 'w-10! h-10!' }">
|
|
323
|
+
<template #date="{ date, selected }">
|
|
324
|
+
<div class="flex flex-col items-center leading-none gap-0.5">
|
|
325
|
+
<span :class="'text-sm ' + (date.otherMonth ? 'text-surface-400 dark:text-surface-600' : isWeekend(date) && !selected ? 'text-red-500 dark:text-red-400' : '')">{{ date.day }}</span>
|
|
326
|
+
<div v-if="!date.otherMonth && getEventsForDate(date.day, date.month).length > 0" class="flex gap-0.5">
|
|
327
|
+
<span v-for="event of getEventsForDate(date.day, date.month)" :key="event.label" :class="'w-1 h-1 rounded-full ' + dotColors[event.type]" :title="event.label"></span>
|
|
328
|
+
</div>
|
|
329
|
+
</div>
|
|
330
|
+
</template>
|
|
331
|
+
</DatePicker>
|
|
332
|
+
</div>
|
|
333
|
+
</template>
|
|
334
|
+
|
|
335
|
+
<script setup>
|
|
336
|
+
import { ref } from 'vue';
|
|
337
|
+
|
|
338
|
+
const date = ref();
|
|
339
|
+
const dotColors = {
|
|
340
|
+
personal: 'bg-blue-500 dark:bg-blue-400',
|
|
341
|
+
work: 'bg-orange-500 dark:bg-orange-400',
|
|
342
|
+
holiday: 'bg-teal-500 dark:bg-teal-400'
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
const isWeekend = (date) => {
|
|
346
|
+
const d = new Date(date.year, date.month, date.day);
|
|
347
|
+
|
|
348
|
+
return d.getDay() === 0 || d.getDay() === 6;
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const getEventsForDate = (day, month) => {
|
|
352
|
+
const events = [];
|
|
353
|
+
const d = new Date(2025, month, day);
|
|
354
|
+
const dayOfWeek = d.getDay();
|
|
355
|
+
|
|
356
|
+
if (dayOfWeek === 1 || dayOfWeek === 3 || dayOfWeek === 5) {
|
|
357
|
+
events.push({ label: 'Standup', type: 'work' });
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if (day === 5 || day === 14 || day === 22) {
|
|
361
|
+
events.push({ label: 'Gym', type: 'personal' });
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if ((month === 0 && day === 1) || (month === 1 && day === 14) || (month === 4 && day === 1) || (month === 11 && day === 25) || (month === 11 && day === 31)) {
|
|
365
|
+
events.push({ label: 'Holiday', type: 'holiday' });
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (dayOfWeek === 4 && (day <= 7 || (day > 14 && day <= 21))) {
|
|
369
|
+
events.push({ label: 'Sprint Review', type: 'work' });
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const seen = new Set();
|
|
373
|
+
|
|
374
|
+
return events.filter((e) => {
|
|
375
|
+
if (seen.has(e.type)) return false;
|
|
376
|
+
seen.add(e.type);
|
|
377
|
+
|
|
378
|
+
return true;
|
|
379
|
+
});
|
|
380
|
+
};
|
|
381
|
+
<\/script>
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
## Inline
|
|
385
|
+
|
|
386
|
+
DatePicker is displayed as a popup by default, add inline property to display the calendar inline.
|
|
387
|
+
|
|
388
|
+
```vue
|
|
389
|
+
<template>
|
|
390
|
+
<div class="flex justify-center">
|
|
391
|
+
<DatePicker v-model="date" inline showWeek class="max-w-full" />
|
|
392
|
+
</div>
|
|
393
|
+
</template>
|
|
394
|
+
|
|
395
|
+
<script setup>
|
|
396
|
+
import { ref } from "vue";
|
|
397
|
+
|
|
398
|
+
const date = ref();
|
|
399
|
+
<\/script>
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Inline Template
|
|
403
|
+
|
|
404
|
+
Custom content can be placed inside date cells in inline mode.
|
|
405
|
+
|
|
406
|
+
```vue
|
|
407
|
+
<template>
|
|
408
|
+
<div class="flex justify-center">
|
|
409
|
+
<DatePicker v-model="date" inline :numberOfMonths="2" :pt="{ day: 'w-12! h-12! rounded-lg!', dayCell: 'p-2!' }">
|
|
410
|
+
<template #date="{ date, selected }">
|
|
411
|
+
<template v-if="!date.otherMonth">
|
|
412
|
+
<div class="flex flex-col items-center gap-1 min-w-12.5">
|
|
413
|
+
<span class="font-semibold text-base">{{ date.day }}</span>
|
|
414
|
+
<span v-if="isFutureOrToday(date)" :class="'text-sm font-medium ' + getPriceClass(date, selected)">{{ '$' + getPrice(date.year, date.month, date.day) }}</span>
|
|
415
|
+
</div>
|
|
416
|
+
</template>
|
|
417
|
+
<span v-else class="invisible">{{ date.day }}</span>
|
|
418
|
+
</template>
|
|
419
|
+
</DatePicker>
|
|
420
|
+
</div>
|
|
421
|
+
</template>
|
|
422
|
+
|
|
423
|
+
<script setup>
|
|
424
|
+
import { ref } from 'vue';
|
|
425
|
+
|
|
426
|
+
const date = ref();
|
|
427
|
+
const today = new Date();
|
|
428
|
+
const priceMap = new Map();
|
|
429
|
+
|
|
430
|
+
today.setHours(0, 0, 0, 0);
|
|
431
|
+
|
|
432
|
+
const isFutureOrToday = (date) => {
|
|
433
|
+
const d = new Date(date.year, date.month, date.day);
|
|
434
|
+
|
|
435
|
+
return d >= today;
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
const getPrice = (year, month, day) => {
|
|
439
|
+
const key = \`\${year}-\${month}-\${day}\`;
|
|
440
|
+
|
|
441
|
+
if (!priceMap.has(key)) {
|
|
442
|
+
priceMap.set(key, Math.floor(Math.random() * 71) + 30);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
return priceMap.get(key);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const getPriceClass = (date, selected) => {
|
|
449
|
+
const price = getPrice(date.year, date.month, date.day);
|
|
450
|
+
const isLow = price < 50;
|
|
451
|
+
|
|
452
|
+
if (selected) {
|
|
453
|
+
return isLow ? 'text-green-200 dark:text-green-900' : 'opacity-70';
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return isLow ? 'text-green-600 dark:text-green-400' : 'text-surface-600 dark:text-surface-400';
|
|
457
|
+
};
|
|
458
|
+
<\/script>
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Float Label
|
|
462
|
+
|
|
463
|
+
A floating label appears on top of the input field when focused. Visit FloatLabel documentation for more information.
|
|
464
|
+
|
|
465
|
+
```vue
|
|
466
|
+
<template>
|
|
467
|
+
<div class="flex flex-wrap justify-center items-end gap-4">
|
|
468
|
+
<FloatLabel>
|
|
469
|
+
<DatePicker v-model="value1" inputId="over_label" showIcon iconDisplay="input" />
|
|
470
|
+
<label for="over_label">Over Label</label>
|
|
471
|
+
</FloatLabel>
|
|
472
|
+
|
|
473
|
+
<FloatLabel variant="in">
|
|
474
|
+
<DatePicker v-model="value2" inputId="in_label" showIcon iconDisplay="input" />
|
|
475
|
+
<label for="in_label">In Label</label>
|
|
476
|
+
</FloatLabel>
|
|
477
|
+
|
|
478
|
+
<FloatLabel variant="on">
|
|
479
|
+
<DatePicker v-model="value3" inputId="on_label" showIcon iconDisplay="input" />
|
|
480
|
+
<label for="on_label">On Label</label>
|
|
481
|
+
</FloatLabel>
|
|
482
|
+
</div>
|
|
483
|
+
</template>
|
|
484
|
+
|
|
485
|
+
<script setup>
|
|
486
|
+
import { ref } from "vue";
|
|
487
|
+
|
|
488
|
+
const value1 = ref(null);
|
|
489
|
+
const value2 = ref(null);
|
|
490
|
+
const value3 = ref(null);
|
|
491
|
+
<\/script>
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
## Ifta Label
|
|
495
|
+
|
|
496
|
+
IftaLabel is used to create infield top aligned labels. Visit IftaLabel documentation for more information.
|
|
497
|
+
|
|
498
|
+
```vue
|
|
499
|
+
<template>
|
|
500
|
+
<div class="flex justify-center">
|
|
501
|
+
<IftaLabel>
|
|
502
|
+
<DatePicker v-model="value" inputId="date" showIcon iconDisplay="input" />
|
|
503
|
+
<label for="date">Date</label>
|
|
504
|
+
</IftaLabel>
|
|
505
|
+
</div>
|
|
506
|
+
</template>
|
|
507
|
+
|
|
508
|
+
<script setup>
|
|
509
|
+
import { ref } from 'vue';
|
|
510
|
+
|
|
511
|
+
const value = ref(null);
|
|
512
|
+
<\/script>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## Clear Icon
|
|
516
|
+
|
|
517
|
+
When showClear is enabled, a clear trigger is added to reset the DatePicker.
|
|
518
|
+
|
|
519
|
+
```vue
|
|
520
|
+
<template>
|
|
521
|
+
<div class="flex justify-center">
|
|
522
|
+
<DatePicker v-model="date" showClear inputClass="w-56!" />
|
|
523
|
+
</div>
|
|
524
|
+
</template>
|
|
525
|
+
|
|
526
|
+
<script setup>
|
|
527
|
+
import { ref } from "vue";
|
|
528
|
+
|
|
529
|
+
const date = ref();
|
|
530
|
+
<\/script>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## Sizes
|
|
534
|
+
|
|
535
|
+
DatePicker provides small and large sizes as alternatives to the base.
|
|
536
|
+
|
|
537
|
+
```vue
|
|
538
|
+
<template>
|
|
539
|
+
<div class="flex flex-col items-center gap-4">
|
|
540
|
+
<DatePicker v-model="value1" size="small" placeholder="Small" showIcon iconDisplay="input" />
|
|
541
|
+
<DatePicker v-model="value2" placeholder="Normal" showIcon iconDisplay="input" />
|
|
542
|
+
<DatePicker v-model="value3" size="large" placeholder="Large" showIcon iconDisplay="input" />
|
|
543
|
+
</div>
|
|
544
|
+
</template>
|
|
545
|
+
|
|
546
|
+
<script setup>
|
|
547
|
+
import { ref } from 'vue';
|
|
548
|
+
|
|
549
|
+
const value1 = ref(null);
|
|
550
|
+
const value2 = ref(null);
|
|
551
|
+
const value3 = ref(null);
|
|
552
|
+
<\/script>
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
## Fluid
|
|
556
|
+
|
|
557
|
+
The fluid prop makes the component take up the full width of its container when set to true.
|
|
558
|
+
|
|
559
|
+
```vue
|
|
560
|
+
<template>
|
|
561
|
+
<DatePicker v-model="date" fluid />
|
|
562
|
+
</template>
|
|
563
|
+
|
|
564
|
+
<script setup>
|
|
565
|
+
import { ref } from "vue";
|
|
566
|
+
|
|
567
|
+
const date = ref();
|
|
568
|
+
<\/script>
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
## Filled
|
|
572
|
+
|
|
573
|
+
Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.
|
|
574
|
+
|
|
575
|
+
```vue
|
|
576
|
+
<template>
|
|
577
|
+
<div class="flex justify-center">
|
|
578
|
+
<DatePicker v-model="date" variant="filled" />
|
|
579
|
+
</div>
|
|
580
|
+
</template>
|
|
581
|
+
|
|
582
|
+
<script setup>
|
|
583
|
+
import { ref } from "vue";
|
|
584
|
+
|
|
585
|
+
const date = ref();
|
|
586
|
+
<\/script>
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## Disabled
|
|
590
|
+
|
|
591
|
+
Use the disabled property to disable a datepicker.
|
|
592
|
+
|
|
593
|
+
```vue
|
|
594
|
+
<template>
|
|
595
|
+
<div class="flex justify-center">
|
|
596
|
+
<DatePicker v-model="date" disabled />
|
|
597
|
+
</div>
|
|
598
|
+
</template>
|
|
599
|
+
|
|
600
|
+
<script setup>
|
|
601
|
+
import { ref } from "vue";
|
|
602
|
+
|
|
603
|
+
const date = ref();
|
|
604
|
+
<\/script>
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
## Invalid
|
|
608
|
+
|
|
609
|
+
Specify the invalid property to display the component with a red border.
|
|
610
|
+
|
|
611
|
+
```vue
|
|
612
|
+
<template>
|
|
613
|
+
<div class="flex flex-wrap justify-center gap-4">
|
|
614
|
+
<DatePicker v-model="date1" :invalid="!date1" placeholder="Date" />
|
|
615
|
+
<DatePicker v-model="date2" :invalid="!date2" variant="filled" placeholder="Date" />
|
|
616
|
+
</div>
|
|
617
|
+
</template>
|
|
618
|
+
|
|
619
|
+
<script setup>
|
|
620
|
+
import { ref } from "vue";
|
|
621
|
+
|
|
622
|
+
const date1 = ref(null);
|
|
623
|
+
const date2 = ref(null);
|
|
624
|
+
<\/script>
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
## Forms
|
|
628
|
+
|
|
629
|
+
DatePicker integrates seamlessly with the PrimeVue Forms library.
|
|
630
|
+
|
|
631
|
+
```vue
|
|
632
|
+
<template>
|
|
633
|
+
<div class="flex justify-center">
|
|
634
|
+
<Form v-slot="$form" :resolver="resolver" :initialValues="initialValues" @submit="onFormSubmit" class="flex flex-col gap-4">
|
|
635
|
+
<div class="flex flex-col gap-1">
|
|
636
|
+
<DatePicker name="date" fluid />
|
|
637
|
+
<Message v-if="$form.date?.invalid" severity="error" size="small" variant="simple">{{ $form.date.error?.message }}</Message>
|
|
638
|
+
</div>
|
|
639
|
+
<Button type="submit" severity="secondary">Submit</Button>
|
|
640
|
+
</Form>
|
|
641
|
+
</div>
|
|
642
|
+
</template>
|
|
643
|
+
|
|
644
|
+
<script setup>
|
|
645
|
+
import { ref } from 'vue';
|
|
646
|
+
import { zodResolver } from '@primevue/forms/resolvers/zod';
|
|
647
|
+
import { useToast } from "primevue/usetoast";
|
|
648
|
+
import { z } from 'zod';
|
|
649
|
+
|
|
650
|
+
const toast = useToast();
|
|
651
|
+
const initialValues = ref({
|
|
652
|
+
date: ''
|
|
653
|
+
});
|
|
654
|
+
const resolver = ref(zodResolver(
|
|
655
|
+
z.object({
|
|
656
|
+
date: z.preprocess((val) => {
|
|
657
|
+
if (val === '' || val === null) {
|
|
658
|
+
return null;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
return new Date(val);
|
|
662
|
+
}, z.union([z.date(), z.null().refine((val) => val !== null, { message: 'Date is required.' })]))
|
|
663
|
+
})
|
|
664
|
+
));
|
|
665
|
+
|
|
666
|
+
const onFormSubmit = ({ valid }) => {
|
|
667
|
+
if (valid) {
|
|
668
|
+
toast.add({ severity: 'success', summary: 'Form is submitted.', life: 3000 });
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
<\/script>
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
## Accessibility
|
|
675
|
+
|
|
676
|
+
Screen Reader Value to describe the component can either be provided via label tag combined with inputId prop or using aria-labelledby , aria-label props. The input element has combobox role in addition to aria-autocomplete as "none", aria-haspopup as "dialog" and aria-expanded attributes. The relation between the input and the popup is created with aria-controls attribute that refers to the id of the popup. The optional datepicker button requires includes aria-haspopup , aria-expanded for states along with aria-controls to define the relation between the popup and the button. The value to read is retrieved from the chooseDate key of the aria property from the locale API. This label is also used for the aria-label of the popup as well. When there is a value selected, it is formatted and appended to the label to be able to notify users about the current value. Popup has a dialog role along with aria-modal and aria-label . The navigation buttons at the header has an aria-label retrieved from the prevYear , nextYear , prevMonth , nextMonth , prevDecade and nextDecade keys of the locale aria API. Similarly month picker button uses the chooseMonth and year picker button uses the chooseYear keys. Main date table uses grid role that contains th elements with col as the scope along with abbr tag resolving to the full name of the month. Each date cell has an aria-label referring to the full date value. Buttons at the footer utilize their readable labels as aria-label as well. Selected date also receives the aria-selected attribute. Timepicker spinner buttons get their labels for aria-label from the aria locale API using the prevHour , nextHour , prevMinute , nextMinute , prevSecond , nextSecond , am and pm keys. DatePicker also includes a hidden section that is only available to screen readers with aria-live as "polite". This element is updated when the selected date changes to instruct the user about the current date selected. Choose Date Button Keyboard Support Key Function space Opens popup and moves focus to the selected date, if there is none focuses on today. enter Opens popup and moves focus to the selected date, if there is none focuses on today. Popup Keyboard Support Key Function escape Closes the popup and moves focus to the input element. tab Moves focus to the next focusable element within the popup. shift + tab Moves focus to the next focusable element within the popup. Header Buttons Keyboard Support Key Function enter Triggers the button action. space Triggers the button action. Date Grid Keyboard Support Key Function enter Selects the date, closes the popup and moves focus to the input element. space Closes the popup and moves focus to the input element. up arrow Moves focus to the same day of the previous week. alt + up arrow Closes the popup and moves focus to the input element. down arrow Moves focus to the same day of the next week. right arrow Moves focus to the next day. left arrow Moves focus to the previous day. home Moves focus to the first day of the current week. end Moves focus to the last day of the current week. page up Changes the date to previous month in date picker mode. Moves to previous year in month picker mode and previous decade in year picker. shift + page up Changes the date to previous year in date picker mode. Has no effect in month or year picker. page down Changes the date to next month in date picker mode. Moves to next year in month picker mode and next decade in year picker. shift + page down Changes the date to next year in date picker mode. Has no effect in month or year picker. Footer Buttons Keyboard Support Key Function enter Triggers the button action. space Triggers the button action.
|
|
677
|
+
|
|
678
|
+
```vue
|
|
679
|
+
<template>
|
|
680
|
+
<label for="date1">Date</label>
|
|
681
|
+
<DatePicker inputId="date1" />
|
|
682
|
+
|
|
683
|
+
<span id="date2">Date</span>
|
|
684
|
+
<DatePicker aria-labelledby="date2" />
|
|
685
|
+
|
|
686
|
+
<DatePicker aria-label="Date" />
|
|
687
|
+
</template>
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
## Date Picker API
|
|
691
|
+
|
|
692
|
+
### Props
|
|
693
|
+
|
|
694
|
+
| Name |Type |Default |Description |
|
|
695
|
+
| --- | --- | --- | --- |
|
|
696
|
+
| modelValue | null \| Date \| Date[] \| (null \| Date)[] | null | Value of the component. |
|
|
697
|
+
| defaultValue | null \| Date \| Date[] \| (null \| Date)[] | - | The default value for the input when not controlled by `modelValue` . |
|
|
698
|
+
| name | string | - | The name attribute for the element, typically used in form submissions. |
|
|
699
|
+
| selectionMode | HintedString<"single" \| "multiple" \| "range"> | single | Defines the quantity of the selection. |
|
|
700
|
+
| dateFormat | string | - | Format of the date. Defaults to PrimeVue Locale configuration. |
|
|
701
|
+
| updateModelType | HintedString<"string" \| "date"> | date | Type of the value to write back to modelValue. |
|
|
702
|
+
| inline | boolean | false | When enabled, displays the datepicker as inline instead of an overlay. |
|
|
703
|
+
| showOtherMonths | boolean | true | Whether to display dates in other months (non-selectable) at the start or end of the current month. To make these days selectable use the selectOtherMonths option. |
|
|
704
|
+
| selectOtherMonths | boolean | false | Whether days in other months shown before or after the current month are selectable. This only applies if the showOtherMonths option is set to true. |
|
|
705
|
+
| showIcon | boolean | false | When enabled, displays a button with icon next to input. |
|
|
706
|
+
| iconDisplay | HintedString<"button" \| "input"> | 'button' | Icon position of the component. This only applies if the showIcon option is set to true. |
|
|
707
|
+
| icon | string | - | Icon of the datepicker button. |
|
|
708
|
+
| prevIcon | string | - | Icon to show in the previous button. |
|
|
709
|
+
| nextIcon | string | - | Icon to show in the next button. |
|
|
710
|
+
| incrementIcon | string | - | Icon to show in each of the increment buttons. |
|
|
711
|
+
| decrementIcon | string | - | Icon to show in each of the decrement buttons. |
|
|
712
|
+
| numberOfMonths | number | 1 | Number of months to display. |
|
|
713
|
+
| responsiveOptions | DatePickerResponsiveOptions[] | - | An array of options for responsive design. |
|
|
714
|
+
| breakpoint | string | 769px | The breakpoint to define the maximum width boundary for datepicker panel. |
|
|
715
|
+
| view | HintedString<"date" \| "month" \| "year"> | date | Type of view to display. |
|
|
716
|
+
| minDate | Date | - | The minimum selectable date. |
|
|
717
|
+
| maxDate | Date | - | The maximum selectable date. |
|
|
718
|
+
| disabledDates | Date[] | - | Array with dates to disable. |
|
|
719
|
+
| disabledDays | number[] | - | Array with disabled weekday numbers. |
|
|
720
|
+
| maxDateCount | number | - | Maximum number of selectable dates in multiple mode. |
|
|
721
|
+
| showOnFocus | boolean | true | When disabled, datepicker will not be visible with input focus. |
|
|
722
|
+
| autoZIndex | boolean | true | Whether to automatically manage layering. |
|
|
723
|
+
| baseZIndex | number | 0 | Base zIndex value to use in layering. |
|
|
724
|
+
| showButtonBar | boolean | false | Whether to display today and clear buttons at the footer. |
|
|
725
|
+
| shortYearCutoff | string | +10 | The cutoff year for determining the century for a date. |
|
|
726
|
+
| showTime | boolean | false | Whether to display timepicker. |
|
|
727
|
+
| timeOnly | boolean | false | Whether to display timepicker only. |
|
|
728
|
+
| hourFormat | HintedString<"12" \| "24"> | 24 | Specifies hour format. |
|
|
729
|
+
| stepHour | number | 1 | Hours to change per step. |
|
|
730
|
+
| stepMinute | number | 1 | Minutes to change per step. |
|
|
731
|
+
| stepSecond | number | 1 | Seconds to change per step. |
|
|
732
|
+
| showSeconds | boolean | false | Whether to show the seconds in time picker. |
|
|
733
|
+
| hideOnDateTimeSelect | boolean | false | Whether to hide the overlay on date selection when showTime is enabled. |
|
|
734
|
+
| hideOnRangeSelection | boolean | false | Whether to hide the overlay on date selection is completed when selectionMode is range. |
|
|
735
|
+
| timeSeparator | string | : | Separator of time selector. |
|
|
736
|
+
| showWeek | boolean | false | When enabled, datepicker will show week numbers. |
|
|
737
|
+
| manualInput | boolean | true | Whether to allow entering the date manually via typing. |
|
|
738
|
+
| showClear | boolean | false | When enabled, a clear icon is displayed to clear the value. |
|
|
739
|
+
| size | HintedString<"small" \| "large"> | - | Defines the size of the component. |
|
|
740
|
+
| invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
|
|
741
|
+
| disabled | boolean | false | When present, it specifies that the component should be disabled. |
|
|
742
|
+
| variant | null \| HintedString<"outlined" \| "filled"> | null | Specifies the input variant of the component. |
|
|
743
|
+
| readonly | boolean | false | When present, it specifies that an input field is read-only. |
|
|
744
|
+
| placeholder | string | - | Placeholder text for the input. |
|
|
745
|
+
| required | boolean | - | |
|
|
746
|
+
| appendTo | HTMLElement \| HintedString<"body" \| "self"> | body | A valid query selector or an HTMLElement to specify where the overlay gets attached. |
|
|
747
|
+
| inputId | string | - | Identifier of the underlying input element. |
|
|
748
|
+
| inputStyle | object | - | Inline style of the input field. |
|
|
749
|
+
| inputClass | string \| object | - | Style class of the input field. |
|
|
750
|
+
| panelStyle | object | - | Inline style of the overlay panel. |
|
|
751
|
+
| panelClass | string \| object | - | Style class of the overlay panel. |
|
|
752
|
+
| todayButtonProps | object | - | Used to pass all properties of the ButtonProps to the today button component. |
|
|
753
|
+
| clearButtonProps | object | - | Used to pass all properties of the ButtonProps to the clear button component. |
|
|
754
|
+
| navigatorButtonProps | object | - | Used to pass all properties of the ButtonProps to the navigator button component. |
|
|
755
|
+
| timepickerButtonProps | object | - | Used to pass all properties of the ButtonProps to the timepicker button component. |
|
|
756
|
+
| fluid | boolean | null | Spans 100% width of the container when enabled. |
|
|
757
|
+
| ariaLabelledby | string | - | Establishes relationships between the component and label(s) where its value should be one or more element IDs. |
|
|
758
|
+
| ariaLabel | string | - | Establishes a string value that labels the component. |
|
|
759
|
+
| formControl | Record<string, any> | - | Form control object, typically used for handling validation and form state. |
|
|
760
|
+
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
|
|
761
|
+
| pt | PassThrough<DatePickerPassThroughOptions> | - | Used to pass attributes to DOM elements inside the component. |
|
|
762
|
+
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
|
|
763
|
+
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
|
|
764
|
+
|
|
765
|
+
### Pass Through Options
|
|
766
|
+
|
|
767
|
+
| Name |Type |Description |
|
|
768
|
+
| --- | --- | --- |
|
|
769
|
+
| root | DatePickerPassThroughOptionType | Used to pass attributes to the root's DOM element. |
|
|
770
|
+
| pcInputText | any | Used to pass attributes to the InputText component. |
|
|
771
|
+
| dropdown | DatePickerPassThroughOptionType | Used to pass attributes to the dropdown's DOM element. |
|
|
772
|
+
| dropdownIcon | DatePickerPassThroughOptionType | Used to pass attributes to the dropdown icon's DOM element. |
|
|
773
|
+
| inputIconContainer | DatePickerPassThroughOptionType | Used to pass attributes to the input icon container's DOM element. |
|
|
774
|
+
| inputIcon | DatePickerPassThroughOptionType | Used to pass attributes to the input icon's DOM element. |
|
|
775
|
+
| clearIcon | DatePickerPassThroughOptionType | Used to pass attributes to the label's DOM element. |
|
|
776
|
+
| panel | DatePickerPassThroughOptionType | Used to pass attributes to the panel's DOM element. |
|
|
777
|
+
| calendarContainer | DatePickerPassThroughOptionType | Used to pass attributes to the calendar container's DOM element. |
|
|
778
|
+
| calendar | DatePickerPassThroughOptionType | Used to pass attributes to the calendar's DOM element. |
|
|
779
|
+
| header | DatePickerPassThroughOptionType | Used to pass attributes to the header's DOM element. |
|
|
780
|
+
| pcPrevButton | any | Used to pass attributes to the previous button's DOM element. |
|
|
781
|
+
| title | DatePickerPassThroughOptionType | Used to pass attributes to the title's DOM element. |
|
|
782
|
+
| selectMonth | DatePickerPassThroughOptionType | Used to pass attributes to the view month's DOM element. |
|
|
783
|
+
| selectYear | DatePickerPassThroughOptionType | Used to pass attributes to the view year's DOM element. |
|
|
784
|
+
| decade | DatePickerPassThroughOptionType | Used to pass attributes to the decade's DOM element. |
|
|
785
|
+
| pcNextButton | any | Used to pass attributes to the next button's DOM element. |
|
|
786
|
+
| dayView | DatePickerPassThroughOptionType | Used to pass attributes to the table's DOM element. |
|
|
787
|
+
| tableHeader | DatePickerPassThroughOptionType | Used to pass attributes to the table header's DOM element. |
|
|
788
|
+
| tableHeaderRow | DatePickerPassThroughOptionType | Used to pass attributes to the table header row's DOM element. |
|
|
789
|
+
| weekHeader | DatePickerPassThroughOptionType | Used to pass attributes to the week header's DOM element. |
|
|
790
|
+
| weekHeaderLabel | DatePickerPassThroughOptionType | Used to pass attributes to the week header label's DOM element. |
|
|
791
|
+
| tableHeaderCell | DatePickerPassThroughOptionType | Used to pass attributes to the table header cell's DOM element. |
|
|
792
|
+
| weekDayCell | DatePickerPassThroughOptionType | Used to pass attributes to the week day cell's DOM element. |
|
|
793
|
+
| weekDay | DatePickerPassThroughOptionType | Used to pass attributes to the week day's DOM element. |
|
|
794
|
+
| tableBody | DatePickerPassThroughOptionType | Used to pass attributes to the table body's DOM element. |
|
|
795
|
+
| tableBodyRow | DatePickerPassThroughOptionType | Used to pass attributes to the table body row's DOM element. |
|
|
796
|
+
| weekNumber | DatePickerPassThroughOptionType | Used to pass attributes to the week number's DOM element. |
|
|
797
|
+
| weekLabelContainer | DatePickerPassThroughOptionType | Used to pass attributes to the week label container's DOM element. |
|
|
798
|
+
| dayCell | DatePickerPassThroughOptionType | Used to pass attributes to the day cell's DOM element. |
|
|
799
|
+
| day | DatePickerPassThroughOptionType | Used to pass attributes to the day's DOM element. |
|
|
800
|
+
| monthView | DatePickerPassThroughOptionType | Used to pass attributes to the month view's DOM element. |
|
|
801
|
+
| month | DatePickerPassThroughOptionType | Used to pass attributes to the month's DOM element. |
|
|
802
|
+
| yearView | DatePickerPassThroughOptionType | Used to pass attributes to the year view's DOM element. |
|
|
803
|
+
| year | DatePickerPassThroughOptionType | Used to pass attributes to the year's DOM element. |
|
|
804
|
+
| timePicker | DatePickerPassThroughOptionType | Used to pass attributes to the time picker's DOM element. |
|
|
805
|
+
| hourPicker | DatePickerPassThroughOptionType | Used to pass attributes to the hour picker's DOM element. |
|
|
806
|
+
| hour | DatePickerPassThroughOptionType | Used to pass attributes to the hour's DOM element. |
|
|
807
|
+
| separatorContainer | DatePickerPassThroughOptionType | Used to pass attributes to the separator container's DOM element. |
|
|
808
|
+
| separator | DatePickerPassThroughOptionType | Used to pass attributes to the separator's DOM element. |
|
|
809
|
+
| minutePicker | DatePickerPassThroughOptionType | Used to pass attributes to the minute picker's DOM element. |
|
|
810
|
+
| minute | DatePickerPassThroughOptionType | Used to pass attributes to the minute's DOM element. |
|
|
811
|
+
| secondPicker | DatePickerPassThroughOptionType | Used to pass attributes to the second picker's DOM element. |
|
|
812
|
+
| second | DatePickerPassThroughOptionType | Used to pass attributes to the second's DOM element. |
|
|
813
|
+
| ampmPicker | DatePickerPassThroughOptionType | Used to pass attributes to the ampm picker's DOM element. |
|
|
814
|
+
| ampm | DatePickerPassThroughOptionType | Used to pass attributes to the ampm's DOM element. |
|
|
815
|
+
| buttonbar | DatePickerPassThroughOptionType | Used to pass attributes to the buttonbar's DOM element. |
|
|
816
|
+
| pcIncrementButton | any | Used to pass attributes to the increment button's DOM element. |
|
|
817
|
+
| pcDecrementButton | any | Used to pass attributes to the decrement button's DOM element. |
|
|
818
|
+
| pcTodayButton | any | Used to pass attributes to the today button's DOM element. |
|
|
819
|
+
| pcClearButton | any | Used to pass attributes to the clear button's DOM element. |
|
|
820
|
+
| hiddenSelectedDay | DatePickerPassThroughOptionType | Used to pass attributes to the aria selected day's DOM element. |
|
|
821
|
+
| hiddenMonth | DatePickerPassThroughOptionType | Used to pass attributes to the aria month's DOM element. |
|
|
822
|
+
| hiddenYear | DatePickerPassThroughOptionType | Used to pass attributes to the aria year's DOM element. |
|
|
823
|
+
| hooks | any | Used to manage all lifecycle hooks. |
|
|
824
|
+
| transition | DatePickerPassThroughTransitionType | Used to control Vue Transition API. |
|
|
825
|
+
|
|
826
|
+
### Theming
|
|
827
|
+
|
|
828
|
+
### CSS Classes
|
|
829
|
+
|
|
830
|
+
| Class |Description |
|
|
831
|
+
| --- | --- |
|
|
832
|
+
| p-datepicker | Class name of the root element |
|
|
833
|
+
| p-datepicker-input | Class name of the input element |
|
|
834
|
+
| p-datepicker-dropdown | Class name of the dropdown element |
|
|
835
|
+
| p-datepicker-input-icon-container | Class name of the input icon container element |
|
|
836
|
+
| p-datepicker-input-icon | Class name of the input icon element |
|
|
837
|
+
| p-datepicker-clear-icon | Class name of the clear icon element |
|
|
838
|
+
| p-datepicker-panel | Class name of the panel element |
|
|
839
|
+
| p-datepicker-calendar-container | Class name of the calendar container element |
|
|
840
|
+
| p-datepicker-calendar | Class name of the calendar element |
|
|
841
|
+
| p-datepicker-header | Class name of the header element |
|
|
842
|
+
| p-datepicker-prev-button | Class name of the previous button element |
|
|
843
|
+
| p-datepicker-title | Class name of the title element |
|
|
844
|
+
| p-datepicker-select-month | Class name of the select month element |
|
|
845
|
+
| p-datepicker-select-year | Class name of the select year element |
|
|
846
|
+
| p-datepicker-decade | Class name of the decade element |
|
|
847
|
+
| p-datepicker-next-button | Class name of the next button element |
|
|
848
|
+
| p-datepicker-day-view | Class name of the day view element |
|
|
849
|
+
| p-datepicker-weekheader | Class name of the week header element |
|
|
850
|
+
| p-datepicker-weeknumber | Class name of the week number element |
|
|
851
|
+
| p-datepicker-weeklabel-container | Class name of the week label container element |
|
|
852
|
+
| p-datepicker-weekday-cell | Class name of the week day cell element |
|
|
853
|
+
| p-datepicker-weekday | Class name of the week day element |
|
|
854
|
+
| p-datepicker-day-cell | Class name of the day cell element |
|
|
855
|
+
| p-datepicker-day | Class name of the day element |
|
|
856
|
+
| p-datepicker-month-view | Class name of the month view element |
|
|
857
|
+
| p-datepicker-month | Class name of the month element |
|
|
858
|
+
| p-datepicker-year-view | Class name of the year view element |
|
|
859
|
+
| p-datepicker-year | Class name of the year element |
|
|
860
|
+
| p-datepicker-time-picker | Class name of the time picker element |
|
|
861
|
+
| p-datepicker-hour-picker | Class name of the hour picker element |
|
|
862
|
+
| p-datepicker-increment-button | Class name of the increment button element |
|
|
863
|
+
| p-datepicker-decrement-button | Class name of the decrement button element |
|
|
864
|
+
| p-datepicker-separator | Class name of the separator element |
|
|
865
|
+
| p-datepicker-minute-picker | Class name of the minute picker element |
|
|
866
|
+
| p-datepicker-second-picker | Class name of the second picker element |
|
|
867
|
+
| p-datepicker-ampm-picker | Class name of the ampm picker element |
|
|
868
|
+
| p-datepicker-buttonbar | Class name of the buttonbar element |
|
|
869
|
+
| p-datepicker-today-button | Class name of the today button element |
|
|
870
|
+
| p-datepicker-clear-button | Class name of the clear button element |
|
|
871
|
+
|
|
872
|
+
### Design Tokens
|
|
873
|
+
|
|
874
|
+
| Token |CSS Variable |Description |
|
|
875
|
+
| --- | --- | --- |
|
|
876
|
+
| datepicker.transition.duration | --p-datepicker-transition-duration | Transition duration of root |
|
|
877
|
+
| datepicker.panel.background | --p-datepicker-panel-background | Background of panel |
|
|
878
|
+
| datepicker.panel.border.color | --p-datepicker-panel-border-color | Border color of panel |
|
|
879
|
+
| datepicker.panel.color | --p-datepicker-panel-color | Color of panel |
|
|
880
|
+
| datepicker.panel.border.radius | --p-datepicker-panel-border-radius | Border radius of panel |
|
|
881
|
+
| datepicker.panel.shadow | --p-datepicker-panel-shadow | Shadow of panel |
|
|
882
|
+
| datepicker.panel.padding | --p-datepicker-panel-padding | Padding of panel |
|
|
883
|
+
| datepicker.header.background | --p-datepicker-header-background | Background of header |
|
|
884
|
+
| datepicker.header.border.color | --p-datepicker-header-border-color | Border color of header |
|
|
885
|
+
| datepicker.header.color | --p-datepicker-header-color | Color of header |
|
|
886
|
+
| datepicker.header.padding | --p-datepicker-header-padding | Padding of header |
|
|
887
|
+
| datepicker.title.gap | --p-datepicker-title-gap | Gap of title |
|
|
888
|
+
| datepicker.title.font.weight | --p-datepicker-title-font-weight | Font weight of title |
|
|
889
|
+
| datepicker.title.font.size | --p-datepicker-title-font-size | Font size of title |
|
|
890
|
+
| datepicker.dropdown.width | --p-datepicker-dropdown-width | Width of dropdown |
|
|
891
|
+
| datepicker.dropdown.sm.width | --p-datepicker-dropdown-sm-width | Sm width of dropdown |
|
|
892
|
+
| datepicker.dropdown.lg.width | --p-datepicker-dropdown-lg-width | Lg width of dropdown |
|
|
893
|
+
| datepicker.dropdown.border.color | --p-datepicker-dropdown-border-color | Border color of dropdown |
|
|
894
|
+
| datepicker.dropdown.hover.border.color | --p-datepicker-dropdown-hover-border-color | Hover border color of dropdown |
|
|
895
|
+
| datepicker.dropdown.active.border.color | --p-datepicker-dropdown-active-border-color | Active border color of dropdown |
|
|
896
|
+
| datepicker.dropdown.border.radius | --p-datepicker-dropdown-border-radius | Border radius of dropdown |
|
|
897
|
+
| datepicker.dropdown.focus.ring.width | --p-datepicker-dropdown-focus-ring-width | Focus ring width of dropdown |
|
|
898
|
+
| datepicker.dropdown.focus.ring.style | --p-datepicker-dropdown-focus-ring-style | Focus ring style of dropdown |
|
|
899
|
+
| datepicker.dropdown.focus.ring.color | --p-datepicker-dropdown-focus-ring-color | Focus ring color of dropdown |
|
|
900
|
+
| datepicker.dropdown.focus.ring.offset | --p-datepicker-dropdown-focus-ring-offset | Focus ring offset of dropdown |
|
|
901
|
+
| datepicker.dropdown.focus.ring.shadow | --p-datepicker-dropdown-focus-ring-shadow | Focus ring shadow of dropdown |
|
|
902
|
+
| datepicker.dropdown.background | --p-datepicker-dropdown-background | Background of dropdown |
|
|
903
|
+
| datepicker.dropdown.hover.background | --p-datepicker-dropdown-hover-background | Hover background of dropdown |
|
|
904
|
+
| datepicker.dropdown.active.background | --p-datepicker-dropdown-active-background | Active background of dropdown |
|
|
905
|
+
| datepicker.dropdown.color | --p-datepicker-dropdown-color | Color of dropdown |
|
|
906
|
+
| datepicker.dropdown.hover.color | --p-datepicker-dropdown-hover-color | Hover color of dropdown |
|
|
907
|
+
| datepicker.dropdown.active.color | --p-datepicker-dropdown-active-color | Active color of dropdown |
|
|
908
|
+
| datepicker.input.icon.color | --p-datepicker-input-icon-color | Color of input icon |
|
|
909
|
+
| datepicker.select.month.hover.background | --p-datepicker-select-month-hover-background | Hover background of select month |
|
|
910
|
+
| datepicker.select.month.color | --p-datepicker-select-month-color | Color of select month |
|
|
911
|
+
| datepicker.select.month.hover.color | --p-datepicker-select-month-hover-color | Hover color of select month |
|
|
912
|
+
| datepicker.select.month.padding | --p-datepicker-select-month-padding | Padding of select month |
|
|
913
|
+
| datepicker.select.month.border.radius | --p-datepicker-select-month-border-radius | Border radius of select month |
|
|
914
|
+
| datepicker.select.month.font.weight | --p-datepicker-select-month-font-weight | Font weight of select month |
|
|
915
|
+
| datepicker.select.month.font.size | --p-datepicker-select-month-font-size | Font size of select month |
|
|
916
|
+
| datepicker.select.year.hover.background | --p-datepicker-select-year-hover-background | Hover background of select year |
|
|
917
|
+
| datepicker.select.year.color | --p-datepicker-select-year-color | Color of select year |
|
|
918
|
+
| datepicker.select.year.hover.color | --p-datepicker-select-year-hover-color | Hover color of select year |
|
|
919
|
+
| datepicker.select.year.padding | --p-datepicker-select-year-padding | Padding of select year |
|
|
920
|
+
| datepicker.select.year.border.radius | --p-datepicker-select-year-border-radius | Border radius of select year |
|
|
921
|
+
| datepicker.select.year.font.weight | --p-datepicker-select-year-font-weight | Font weight of select year |
|
|
922
|
+
| datepicker.select.year.font.size | --p-datepicker-select-year-font-size | Font size of select year |
|
|
923
|
+
| datepicker.group.border.color | --p-datepicker-group-border-color | Border color of group |
|
|
924
|
+
| datepicker.group.gap | --p-datepicker-group-gap | Gap of group |
|
|
925
|
+
| datepicker.day.view.margin | --p-datepicker-day-view-margin | Margin of day view |
|
|
926
|
+
| datepicker.week.day.padding | --p-datepicker-week-day-padding | Padding of week day |
|
|
927
|
+
| datepicker.week.day.font.weight | --p-datepicker-week-day-font-weight | Font weight of week day |
|
|
928
|
+
| datepicker.week.day.font.size | --p-datepicker-week-day-font-size | Font size of week day |
|
|
929
|
+
| datepicker.week.day.color | --p-datepicker-week-day-color | Color of week day |
|
|
930
|
+
| datepicker.date.hover.background | --p-datepicker-date-hover-background | Hover background of date |
|
|
931
|
+
| datepicker.date.selected.background | --p-datepicker-date-selected-background | Selected background of date |
|
|
932
|
+
| datepicker.date.range.selected.background | --p-datepicker-date-range-selected-background | Range selected background of date |
|
|
933
|
+
| datepicker.date.color | --p-datepicker-date-color | Color of date |
|
|
934
|
+
| datepicker.date.hover.color | --p-datepicker-date-hover-color | Hover color of date |
|
|
935
|
+
| datepicker.date.selected.color | --p-datepicker-date-selected-color | Selected color of date |
|
|
936
|
+
| datepicker.date.range.selected.color | --p-datepicker-date-range-selected-color | Range selected color of date |
|
|
937
|
+
| datepicker.date.width | --p-datepicker-date-width | Width of date |
|
|
938
|
+
| datepicker.date.height | --p-datepicker-date-height | Height of date |
|
|
939
|
+
| datepicker.date.border.radius | --p-datepicker-date-border-radius | Border radius of date |
|
|
940
|
+
| datepicker.date.padding | --p-datepicker-date-padding | Padding of date |
|
|
941
|
+
| datepicker.date.focus.ring.width | --p-datepicker-date-focus-ring-width | Focus ring width of date |
|
|
942
|
+
| datepicker.date.focus.ring.style | --p-datepicker-date-focus-ring-style | Focus ring style of date |
|
|
943
|
+
| datepicker.date.focus.ring.color | --p-datepicker-date-focus-ring-color | Focus ring color of date |
|
|
944
|
+
| datepicker.date.focus.ring.offset | --p-datepicker-date-focus-ring-offset | Focus ring offset of date |
|
|
945
|
+
| datepicker.date.focus.ring.shadow | --p-datepicker-date-focus-ring-shadow | Focus ring shadow of date |
|
|
946
|
+
| datepicker.date.font.weight | --p-datepicker-date-font-weight | Font weight of date |
|
|
947
|
+
| datepicker.date.font.size | --p-datepicker-date-font-size | Font size of date |
|
|
948
|
+
| datepicker.month.view.margin | --p-datepicker-month-view-margin | Margin of month view |
|
|
949
|
+
| datepicker.month.padding | --p-datepicker-month-padding | Padding of month |
|
|
950
|
+
| datepicker.month.border.radius | --p-datepicker-month-border-radius | Border radius of month |
|
|
951
|
+
| datepicker.year.view.margin | --p-datepicker-year-view-margin | Margin of year view |
|
|
952
|
+
| datepicker.year.padding | --p-datepicker-year-padding | Padding of year |
|
|
953
|
+
| datepicker.year.border.radius | --p-datepicker-year-border-radius | Border radius of year |
|
|
954
|
+
| datepicker.buttonbar.padding | --p-datepicker-buttonbar-padding | Padding of buttonbar |
|
|
955
|
+
| datepicker.buttonbar.border.color | --p-datepicker-buttonbar-border-color | Border color of buttonbar |
|
|
956
|
+
| datepicker.time.picker.padding | --p-datepicker-time-picker-padding | Padding of time picker |
|
|
957
|
+
| datepicker.time.picker.border.color | --p-datepicker-time-picker-border-color | Border color of time picker |
|
|
958
|
+
| datepicker.time.picker.gap | --p-datepicker-time-picker-gap | Gap of time picker |
|
|
959
|
+
| datepicker.time.picker.button.gap | --p-datepicker-time-picker-button-gap | Button gap of time picker |
|
|
960
|
+
| datepicker.time.picker.color | --p-datepicker-time-picker-color | Color of time picker label |
|
|
961
|
+
| datepicker.time.picker.font.weight | --p-datepicker-time-picker-font-weight | Font weight of time picker label |
|
|
962
|
+
| datepicker.time.picker.font.size | --p-datepicker-time-picker-font-size | Font size of time picker label |
|
|
963
|
+
| datepicker.today.background | --p-datepicker-today-background | Background of today |
|
|
964
|
+
| datepicker.today.color | --p-datepicker-today-color | Color of today |
|