Date/month picker

The v-date-picker is stand-alone component that can be utilized in many existing Vuetify components. It offers the user a visual representation for selecting date/month.

用例

Date pickers come in two orientation variations, portrait (default) and landscape. By default they are emitting input event when the day (for date picker) or month (for month picker), but with reactive prop they can update the model even after clicking year/month.

API

v-date-picker
名称
allowed-dates
默认值
null
类型
function

Components.DatePickers.

名称
color
默认值
undefined
类型
string

将指定的色彩应用与控件

名称
dark
默认值
false
类型
boolean

应用暗黑主题变体

名称
day-format
默认值
null
类型
function

Components.DatePickers.

名称
disabled New in — v1.4
默认值
false
类型
boolean

Components.DatePickers.

名称
event-color
默认值
warning
类型
array | function | object | string

Components.DatePickers.

名称
events
默认值
null
类型
array | function | object

Components.DatePickers.

名称
first-day-of-week
默认值
0
类型
string | number

Components.DatePickers.

名称
full-width
默认值
false
类型
boolean

Forces 100% width

名称
header-color
默认值
undefined
类型
string

定义标题颜色。如果未指定,将使用由颜色(color)属性或默认选取器颜色定义的颜色。

名称
header-date-format
默认值
null
类型
function

Components.DatePickers.

名称
landscape
默认值
false
类型
boolean

Orients picker horizontal

名称
light
默认值
false
类型
boolean

应用明亮主题变体

名称
locale
默认值
'en-us'
类型
string

Components.DatePickers.

名称
max
默认值
undefined
类型
string

设置最大宽度

名称
min
默认值
undefined
类型
string

设置最小宽度

名称
month-format
默认值
null
类型
function

Components.DatePickers.

名称
multiple New in — v1.2
默认值
false
类型
boolean

Components.DatePickers.

名称
next-icon
默认值
'$vuetify.icons.next'
类型
string

Components.DatePickers.

名称
no-title
默认值
false
类型
boolean

隐藏选取器标题

名称
picker-date
默认值
undefined
类型
string

Components.DatePickers.

名称
prev-icon
默认值
'$vuetify.icons.prev'
类型
string

Components.DatePickers.

名称
reactive
默认值
false
类型
boolean

Components.DatePickers.

名称
readonly
默认值
false
类型
boolean

Components.DatePickers.

名称
scrollable
默认值
false
类型
boolean

Components.DatePickers.

名称
show-current
默认值
true
类型
boolean | string

Components.DatePickers.

名称
show-week New in — v1.4
默认值
false
类型
boolean

Components.DatePickers.

名称
title-date-format
默认值
null
类型
function

Components.DatePickers.

名称
type
默认值
'date'
类型
string

Components.DatePickers.

名称
value
默认值
undefined
类型
array | string

控制可见性

名称
weekday-format New in — v1.3
默认值
null
类型
function

Components.DatePickers.

名称
width
默认值
290
类型
number | string

内容的宽度

名称
year-format
默认值
null
类型
function

Components.DatePickers.

名称
year-icon
默认值
undefined
类型
string

Components.DatePickers.

示例

Date pickers - Colors

Date picker colors can be set using the color and header-color props. If header-color prop is not provided header will use the color prop value.

Date pickers - In dialog and menu

When integrating a picker into a v-text-field, it is recommended to use the readonly prop. This will prevent mobile keyboards from triggering. To save vertical space, you can also hide the picker title.

Pickers expose a scoped slot that allow you to hook into save and cancel functionality. This will maintain an old value which can be replaced if the user cancels.

Date pickers - formatting date

If you need to display date in the custom format (different than YYYY-MM-DD) you need to use the formatting function.

Date pickers - formatting date using external libs

Formatting dates is possible also with external libs such as Moment.js or date-fns

Date pickers - Allowed dates

You can specify allowed dates using arrays, objects, and functions.

Date pickers - Mutiple

Date picker can now select multiple dates with the multiple prop. If using multiple then date picker expects its model to be an array.

Date pickers - Setting picker width

You can specify allowed the picker's width or make it full width.

Date pickers - birthday picker

Starting with year picker by default, resticting dates range and closing the picker menu after selecting the day make the perfect birthday picker.

Date pickers - react to displayed month/year change

You can watch the pickerDate which is the displayed month/year (depending on the picker type and active view) to perform some action when it changes.

Date pickers - Events

You can specify events using arrays, objects or functions. To change the default color of the event use event-color prop. Your events function or object can return an array of colors (material or css) in case you want to display multiple event indicators.

Date pickers - Internationalization

The date picker supports internationalization through the JavaScript Date object. Specify a BCP 47 language tag using the locale prop, and then set the first day of the week with the first-day-of-week prop.

Date pickers - icons

You can override the default icons used in the picker.

Date pickers - read only

Selecting new date could be disabled by adding readonly prop.

Date pickers - current date indicator

By default the current date is displayed using outline button - show-current prop allows you to remove the border or select different date to be displayed as the current one.

Month pickers

Month pickers come in two orientation variations, portrait (default) and landscape.

Month pickers - Colors

Month picker colors can be set using the color and header-color props. If header-color prop is not provided header will use the color prop value.

Month pickers - In dialog and menu

When integrating a picker into a v-text-field, it is recommended to use the readonly prop. This will prevent mobile keyboards from triggering. To save vertical space, you can also hide the picker title.

Pickers expose a scoped slot that allow you to hook into save and cancel functionality. This will maintain an old value which can be replaced if the user cancels.

Month pickers - Allowed months

You can specify allowed months using arrays, objects or functions.

Month pickers - Multiple

Month pickers can now select multiple months with the multiple prop. If using multiple then the month picker expects its model to be an array.

Month pickers - Setting picker width

You can specify allowed the picker's width or make it full width.

Month pickers - Internationalization

The month picker supports internationalization through the JavaScript Date object. Specify a BCP 47 language tag using the locale prop, and then set the first day of the week with the first-day-of-week prop.

Month pickers - icons

You can override the default icons used in the picker.

Month pickers - read only

Selecting new date could be disabled by adding readonly prop.

Month pickers - current month indicator

By default the current month is displayed using outline button - show-current prop allows you to remove the border or select different month to be displayed as the current one.

Edit this page | language on Github
Vuetify 3 is now available!The latest version of Vuetify is now available!
Learn about Vuetify 3's new features and functionality for modern Vue applications
Start exploringExplore