Calendar

Usage

A calendar allows users to pick a single date or a range of dates from a visual calendar. This component must be used to consistently allow date selection in other contexts. It does not provide the text input functionality of an input type date or a custom text date-picker.

Best practices

Do

If the calendar is triggered by another component, close the calendar upon selection, unless a range is allowed.

Don't

Do not use a calendar for entering a birth date or if the date goes ±10 years to the future or past. Use an input component instead.

Single-month

Use preferably for single-date selections or when the range is not likely to go across several months.

Multi-month

Use when the expected date ranges might go across multiple months. If you only need a single date selection, save space and drive purpose by using the single-month calendar instead.

Days

Days in the calendar can be styled to reflect their state and purpose. Use days’ states as intended.

Do

Use selected to mark the selected date in the calendar.

Do

Use today to mark the current date on the calendar.

Do

Use highlight to mark all the selected dates in a range or to highlight the week in the agenda.

Do

Use blocked to mark dates that are not available. Days are therefore not selectable.

Do

Use muted to mark days that do not belong to the current month but are still selectable.

Examples

Live Preview

Props

NameDescription Type Default Values
v-model
model-value
The selected date(s) of the calendar.ArrayArray<Date>
first-day-of-week
Sets the first day of the week for different countries. 0 is Sunday and 1 is Monday.Number0, 1, 2, 3, 4, 5, 6
multi-month
Controls whether the calendar is multi month or not.Booleanfalse
range
Controls whether the calendar is range.Booleanfalse
dates-disabled
Controls which dates are blocked from being selected.Object{}{ before: Date, after: Date, dates: Array<Date>, ranges: Array<{ from: Date, to: Date }> }
dates-highlighted
Controls which dates are highlighted.Object{}{ before: Date, after: Date, dates: Array<Date>, ranges: Array<{ from: Date, to: Date }> }
highlight-current-week
Highlights the current week based on the selected date.Booleanfalse
locale
The locale to use for the calendar.String'default'default, de-DE, en-GB, en-US, es-CO, es-MX, es-ES, es-US, it-IT, pl-PL, pt-BR, pt-PT, tr-TR
full-width
Controls if the button extends to fill the width of the container.Booleanfalse
translations
Object with all necessary translations.object{ month: 'Month', year: 'Year', previousMonth: 'Previous month', nextMonth: 'Next month', }{ month, year, previousMonth, nextMonth }

Events

NameDescription Type
v-model
update:modelValue
Emits the selected date(s). If the calendar is single month, it will emit an array with one date. If the calendar is multi * month, it will emit an array with two dates.{ "names": [ "Array<Date>" ] }
select
Emits the selected date.{ "names": [ "Date" ] }