Date Range Picker
A component for selecting a range of dates.
Anatomy
<script setup lang="ts">
import {
VcDateRangePickerRoot,
VcDateRangePickerHeader,
VcDateRangePickerGrid,
VcDateRangePickerDate,
} from '@wisemen/vue-core-components'
</script>
<template>
<VcDateRangePickerRoot>
<VcDateRangePickerHeader />
<VcDateRangePickerGrid>
<template #date>
<VcDateRangePickerDate />
</template>
</VcDateRangePickerGrid>
</VcDateRangePickerRoot>
</template>Props
The accessible label for the date picker.
-Whether selecting an already selected date should deselect it.
falseWhen combined with isDateUnavailable, determines whether non-contiguous ranges, i.e. ranges containing unavailable dates, may be selected.
falseThe class configuration for the component. This allows customizating the default styles by overriding them with custom values.
-Whether the calendar should focus on the selected day, today’s date, or the first day of the month when mounted.
falseA function to determine whether a specific date should be disabled.
A date that is restricted by rules or settings, such as blackout dates, min/max date limits, or days that should never be selectable (e.g., weekends in a work calendar). These dates are predefined as unselectable, regardless of external availability.
falseA function to determine whether a specific date is unavailable.
A date that is not selectable because it is already booked, occupied, or reserved based on external data (e.g., a hotel booking system showing fully booked days). The user sees these dates but cannot pick them.
falseDetermines whether the element is disabled. When true, the element becomes non-interactive.
falseThe latest selectable date.
nullThe earliest selectable date.
nullWhether the calendar should display two months instead of one.
falseA unique identifier used for testing purposes. If set to null, no test ID will be applied.
nullThe visual style of the date range picker.
nullMethods
A function to determine whether a specific date should be disabled.
A date that is restricted by rules or settings, such as blackout dates, min/max date limits, or days that should never be selectable (e.g., weekends in a work calendar). These dates are predefined as unselectable, regardless of external availability.
(date: Date) => booleanA function to determine whether a specific date is unavailable.
A date that is not selectable because it is already booked, occupied, or reserved based on external data (e.g., a hotel booking system showing fully booked days). The user sees these dates but cannot pick them.
(date: Date) => booleanDefault styles
-group/date group/date relative select-none isolate data-outside-view:invisible flex items-center justify-center text-sm text-secondary not-data-highlighted:not-data-highlighted-start:not-data-selected:not-data-selection-start:not-data-selection-end:data-outside-view:text-disabled data-disabled:text-disabled data-unavailable:text-disabled data-highlighted:bg-brand-secondary data-selected:bg-brand-secondary data-highlighted-start:bg-brand-secondary data-highlighted-end:bg-brand-secondary data-selection-start:bg-brand-secondary data-selection-end:bg-brand-secondary dark:data-highlighted:bg-brand-950 dark:data-selected:bg-brand-950 dark:data-highlighted-start:bg-brand-950 dark:data-highlighted-end:bg-brand-950 dark:data-selection-start:bg-brand-950 dark:data-selection-end:bg-brand-950 data-highlighted:text-brand-primary data-selected:text-brand-primary data-highlighted-start:text-primary-on-brand data-highlighted-end:text-primary-on-brand data-selection-start:text-primary-on-brand data-selection-end:text-primary-on-brand data-first-day-of-week:rounded-l-full data-first-day-of-month:rounded-l-full data-last-day-of-week:rounded-r-full data-last-day-of-month:rounded-r-full data-selection-start:rounded-l-full data-selection-end:rounded-r-full data-highlighted-start:rounded-l-full data-highlighted-end:rounded-r-full data-highlighted-end:not-data-highlighted-start:not-data-first-day-of-week:not-data-first-day-of-month:rounded-l-none cursor-pointer data-disabled:cursor-not-allowed size-10 outline-brand-500 data-selected:outline-offset-2w-70flex flex-col gap-y-xsflex gap-xlgrid grid-cols-7 items-centergrid grid-cols-[1fr_auto_1fr] items-center size-fullflex justify-between gap-xl mb-lgw-px bg-tertiaryabsolute bottom-1 left-1/2 -translate-x-1/2 size-1 rounded-full bg-brand-solid group-data-selection-start/date:bg-white group-data-selection-end/date:bg-white group-data-highlighted-start/date:bg-white group-data-highlighted-end/date:bg-whitefont-medium text-secondary text-sm size-10 flex items-center justify-centersize-full flex items-center justify-center rounded-full group-data-highlighted-start/date:bg-brand-solid group-data-highlighted-end/date:bg-brand-solid group-data-selection-start/date:bg-brand-solid group-data-selection-end/date:bg-brand-solid not-group-data-selected/date:group-hover/date:bg-brand-primary