WlDatePicker

Date or range selection. In single mode, the model is an ISO string/null; in range mode, [start, end|null]/null. Locale comes from WlConfig.
Components / Inputs v0.1.0

Change props to see the result: the example and code use the same settings. “Reset” restores the initial values.

Settings

selectionMode

single: ISO string/null; range: [start, end|null]/null. The first selection sets the start, the second completes and sorts the range, and the next starts a new one.

size

Field size.

displayFormat

Display and manual input format; the model remains ISO.

placeholder

Placeholder; falls back to WlConfig.locale.datePlaceholder (dd.mm.yyyy in English).

startLabel

Visible range start label; falls back to WlConfig.locale.dateFrom (From in English).

endLabel

Visible range end label; falls back to WlConfig.locale.dateTo (To in English).

minDate

Minimum date in "YYYY-MM-DD" format. Empty or invalid values do not restrict selection.

maxDate

Maximum date in "YYYY-MM-DD" format. Empty or invalid values do not restrict selection.

Disables the field.

Error state.

Calendar icon button.

Calendar animation; defaults to WlConfig.motion (true).

Props pt, density, formatOptions, disabledDates, rangePresets, models, handlers and slots can be edited in the SFC. See their descriptions in API.

Example

2026-10-15

Focus: outside the example · pointer: outside the example

Explore the live example and copy its Vue SFC into your application. Settings on the left can be combined.

Code for your application

Vue SFC · current settings
<script setup lang="ts">
const props = { preview: {} as Record<string, unknown> };
import { WlDatePicker, type WlDatePickerSelectionMode, type WlDateRange } from "legato-ui";
import { computed, ref } from "vue";
const selectionMode = computed<WlDatePickerSelectionMode>(() => props.preview?.selectionMode === "range" ? "range" : "single");
const forwardedPreview = computed(() => {
  const attributes = { ...props.preview };
  delete attributes.selectionMode;
  return attributes;
});
const single = ref<string | null>("2026-10-15");
const range = ref<WlDateRange | null>(["2026-10-15", "2026-10-20"]);
// The host app owns WlConfig: locale: wlLocaleRu retains Russian in 1.0.
// Omitted text follows that locale. Explicit range labels below belong to the app.
</script>

<template>
  <div class="wl-stack" data-space="md">
    <WlDatePicker
      v-if="selectionMode === 'single'"
      v-model="single"
      selection-mode="single"
      show-icon
      min-date="2026-10-01"
      max-date="2026-10-31"
      display-format="locale"
      :format-options="{ year: 'numeric', month: 'long', day: 'numeric' }"
      :disabled-dates="['2026-10-18']"
      aria-label="Date in October"
      v-bind="forwardedPreview"
    />
    <WlDatePicker
      v-else
      v-model="range"
      selection-mode="range"
      show-icon
      start-label="From"
      end-label="To"
      min-date="2026-10-01"
      max-date="2026-10-31"
      display-format="locale"
      :format-options="{ year: 'numeric', month: 'long', day: 'numeric' }"
      :disabled-dates="['2026-10-18']"
      :range-presets="[{ label: 'Week', value: ['2026-10-12', '2026-10-16'] }]"
      aria-label="Dates in October"
      v-bind="forwardedPreview"
    />
    <p role="status">{{ selectionMode === 'range' ? JSON.stringify(range) : single ?? 'null' }}</p>
  </div>
</template>

Single date and start–end range

Three sizes, shared focus ring, manual ISO input, minDate/maxDate, [start,end|null] range, error, disabled and clearing.

Sizes, format and available dates

Dates in October 2026.
Dates in October 2026.
Dates in October 2026.
YYYY-MM-DD; the model always remains ISO.

ArrowDown opens the calendar and focuses the date. Arrow keys move between days, Home/End within a week, PageUp/PageDown between months. Enter commits manual input; Escape closes the panel.

Range from start to end

Select start and end in one calendar or enter dates. Both limits are inclusive; dates in October 2026 are available.

The first selection stores [start, null] and keeps the calendar open. The second completes the range, sorts the dates and closes the panel. After completion, a new selection starts a new range. Clearing To preserves the start; clearing From clears everything.

Range model: ["2026-10-15","2026-10-20"]

Error, disabled and clearing

ISO model: 2026-10-15

Vue SFC · additional example
<script setup lang="ts">
import { WlButton, WlDatePicker, type WlDateRange, WlField } from "legato-ui";
import { ref } from "vue";
const date = ref<string | null>("2026-10-15");
const period = ref<WlDateRange | null>(["2026-10-15", "2026-10-20"]);
</script>

<template>
  <div class="wl-stack" data-space="xl" data-input-example="WlDatePicker">
    <section class="wl-stack" data-space="md" aria-label="Date: format and limits">
      <h3 class="wl-heading-4">{{ "Sizes, format and available dates" }}</h3>
      <div class="wl-grid" data-space="lg">
        <WlField
          v-for="size in ['sm', 'md', 'lg'] as const"
          :id="`docs-date-${size}`"
          :key="size"
          v-slot="{ id, ariaDescribedby }"
          :label="`${'Meeting date, '}${size}`"
          hint="Dates in October 2026."
        ><WlDatePicker
          :id="id"
          v-model="date"
          :size="size"
          show-icon
          min-date="2026-10-01"
          max-date="2026-10-31"
          :aria-describedby="ariaDescribedby"
        /></WlField>
        <WlField
          id="docs-date-iso"
          v-slot="{ id, ariaDescribedby }"
          label="Manual input in ISO format"
          hint="YYYY-MM-DD; the model always remains ISO."
        ><WlDatePicker
          :id="id"
          v-model="date"
          display-format="yyyy-mm-dd"
          placeholder="YYYY-MM-DD"
          min-date="2026-10-01"
          max-date="2026-10-31"
          :aria-describedby="ariaDescribedby"
        /></WlField>
      </div>
      <p class="wl-body-sm wl-muted">{{ "ArrowDown opens the calendar and focuses the date. Arrow keys move between days, Home/End within a week, PageUp/PageDown between months. Enter commits manual input; Escape closes the panel." }}</p>
    </section>
    <section class="wl-stack" data-space="md" aria-label="Date range">
      <h3 class="wl-heading-4">{{ "Range from start to end" }}</h3>
      <WlField
        id="docs-date-range"
        v-slot="{ id, ariaDescribedby, invalid }"
        label="Travel dates"
        hint="Select start and end in one calendar or enter dates. Both limits are inclusive; dates in October 2026 are available."
        :error="period && !period[1] ? 'Choose a trip end date.' : undefined"
      >
        <WlDatePicker
          :id="id"
          v-model="period"
          selection-mode="range"
          show-icon
          name="trip-date"
          start-label="From"
          end-label="To"
          min-date="2026-10-01"
          max-date="2026-10-31"
          :invalid="invalid"
          :aria-describedby="ariaDescribedby"
          data-testid="docs-date-range"
        />
      </WlField>
      <p class="wl-body-sm wl-muted">{{ "The first selection stores [start, null] and keeps the calendar open. The second completes the range, sorts the dates and closes the panel. After completion, a new selection starts a new range. Clearing To preserves the start; clearing From clears everything." }}</p>
      <div class="wl-inline" data-space="sm">
        <WlButton size="sm" @click="period = null">{{ "Clear range" }}</WlButton>
        <WlButton size="sm" @click="period = ['2026-10-15', '2026-10-20']">{{ "Restore October 15–20" }}</WlButton>
      </div>
      <output
        class="wl-body-sm"
        aria-live="polite"
        aria-label="Range model:"
        data-testid="docs-date-range-model"
      >{{ "Range model:" }} {{ JSON.stringify(period) }}</output>
      <WlField id="docs-date-range-disabled" v-slot="{ id }" label="Unavailable range"><WlDatePicker
        :id="id"
        :model-value="['2026-10-15', '2026-10-20']"
        selection-mode="range"
        show-icon
        disabled
      /></WlField>
    </section>
    <section class="wl-stack" data-space="md" aria-label="Date: error and clearing">
      <h3 class="wl-heading-4">{{ "Error, disabled and clearing" }}</h3>
      <div class="wl-grid" data-space="lg">
        <WlField
          id="docs-date-required"
          v-slot="{ id, ariaDescribedby, invalid }"
          label="Required date"
          :error="date ? undefined : 'Choose a meeting date.'"
        ><WlDatePicker
          :id="id"
          v-model="date"
          show-icon
          min-date="2026-10-01"
          max-date="2026-10-31"
          :invalid="invalid"
          :aria-describedby="ariaDescribedby"
        /></WlField>
        <WlField id="docs-date-disabled" v-slot="{ id }" label="Unavailable date"><WlDatePicker
          :id="id"
          model-value="2026-10-15"
          show-icon
          disabled
        /></WlField>
      </div>
      <div class="wl-inline" data-space="sm">
        <WlButton size="sm" @click="date = null">{{ "Clear date" }}</WlButton>
        <WlButton size="sm" @click="date = '2026-10-15'">{{ "Restore October 15" }}</WlButton>
      </div>
      <p class="wl-body-sm" role="status">{{ "ISO model:" }} {{ date ?? 'null' }}</p>
    </section>
  </div>
</template>