Reka UI logoReka
backdrop
Components

Date Picker

Facilitates the selection of dates through an input and calendar-based interface.
mm
dd
yyyy

Features

  • Full keyboard navigation
  • Can be controlled or uncontrolled
  • Focus is fully managed
  • Localization support
  • Accessible by default
  • Supports both date and date-time formats

Preface

The component works with the Temporal API: its values are Temporal.PlainDate, Temporal.PlainDateTime or Temporal.ZonedDateTime. Reka UI does not bundle a Temporal implementation, so on runtimes without native Temporal your app loads a polyfill. See Dates & Times for the setup and how the components treat calendars and time zones.

Installation

On runtimes without native Temporal, install a polyfill and load it once, before the app mounts.

sh
$ npm add temporal-polyfill-lite
ts
// main.ts
import { install } from 'temporal-polyfill-lite/shim'

install(false) // keeps the native Temporal when the browser has one

Install the component from your command line.

sh
$ npm add reka-ui

Anatomy

Import all parts and piece them together.

vue
<script setup>
import {
  DatePickerAnchor,
  DatePickerArrow,
  DatePickerCalendar,
  DatePickerCell,
  DatePickerCellTrigger,
  DatePickerClose,
  DatePickerContent,
  DatePickerField,
  DatePickerGrid,
  DatePickerGridBody,
  DatePickerGridHead,
  DatePickerGridRow,
  DatePickerHeadCell,
  DatePickerHeader,
  DatePickerHeading,
  DatePickerInput,
  DatePickerNext,
  DatePickerPrev,
  DatePickerRoot,
  DatePickerTrigger,
} from 'reka-ui'
</script>

<template>
  <DatePickerRoot>
    <DatePickerField>
      <DatePickerInput />
      <DatePickerTrigger />
    </DatePickerField>

    <DatePickerAnchor />
    <DatePickerContent>
      <DatePickerClose />
      <DatePickerArrow />

      <DatePickerCalendar>
        <DatePickerHeader>
          <DatePickerPrev />
          <DatePickerHeading />
          <DatePickerNext />
        </DatePickerHeader>

        <DatePickerGrid>
          <DatePickerGridHead>
            <DatePickerGridRow>
              <DatePickerHeadCell />
            </DatePickerGridRow>
          </DatePickerGridHead>

          <DatePickerGridBody>
            <DatePickerGridRow>
              <DatePickerCell>
                <DatePickerCellTrigger />
              </DatePickerCell>
            </DatePickerGridRow>
          </DatePickerGridBody>
        </DatePickerGrid>
      </DatePickerCalendar>
    </DatePickerContent>
  </DatePickerRoot>
</template>

API Reference

Root

Contains all the parts of a date picker

Field

Contains the date picker date field segments and trigger

Data AttributeValue
[data-readonly]Present when readonly
[data-disabled]Present when disabled
[data-invalid]Present when invalid

Input

Contains the date picker date field segments

Data AttributeValue
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-placeholder]Present when no value is set

Trigger

The button that toggles the popover. By default, the DatePickerContent will position itself against the trigger. A trigger that holds only an icon has no accessible name, so give it an aria-label (for example aria-label="Open calendar").

Content

The component that pops out when the popover is open.

Arrow

An optional arrow element to render alongside the popover. This can be used to help visually link the anchor with the DatePickerContent. Must be rendered inside DatePickerContent.

Close

The button that closes an open date picker.

Anchor

An optional element to position the DatePickerContent against. If this part is not used, the content will position alongside the DatePickerTrigger.

Calendar

Contains all the parts of a calendar

Data AttributeValue
[data-disabled]Present when disabled
[data-invalid]Present when invalid
[data-readonly]Present when readonly

Contains the navigation buttons and the heading segments.

Prev Button

Calendar navigation button. It navigates the calendar one month/year/decade in the past based on the current calendar view.

Data AttributeValue
[data-disabled]Present when disabled

Next Button

Calendar navigation button. It navigates the calendar one month/year/decade in the future based on the current calendar view.

Data AttributeValue
[data-disabled]Present when disabled

Heading

Heading for displaying the current month and year/

Grid

Container for wrapping the calendar grid.

Data AttributeValue
[data-disabled]Present when disabled
[data-readonly]Present when readonly

Grid Head

Container for wrapping the grid head.

Grid Body

Container for wrapping the grid body.

Grid Row

Container for wrapping the grid row.

Head Cell

Container for wrapping the head cell. Used for displaying the week days.

Cell

Container for wrapping the calendar cells.

Data AttributeValue
[data-disabled]Present when disabled

Cell Trigger

Interactable container for displaying the cell dates. Clicking it selects the date.

Data AttributeValue
[data-selected]Present when selected
[data-value]The ISO string value of the date.
[data-disabled]Present when disabled
[data-unavailable]Present when unavailable
[data-today]Present when today
[data-outside-view]Present when the date is outside the current month it is displayed in.
[data-outside-visible-view]Present when the date is outside the months that are visible on the calendar.
[data-focused]Present when focused

View

Renders its content only while the calendar's view matches. Wrap each of the day, month and year grids in one to let users drill between them; a picker that only shows the day grid can omit it.

View Trigger

The calendar heading as a button that switches to the next coarser view (day → month → year) up to maxView. Selecting a cell in a coarser view drills back down without changing the value or closing the popover.

Examples

Booking a day

min-value and max-value bound the dates, and is-date-unavailable strikes out days that can't be picked, here weekends (with isWeekend from reka-ui/date, which follows the locale) and fully booked days. Inside a FieldRoot the picker's field takes the field's name and required, and a validate function explains what's wrong with a date the user typed into the segments. Inside a FormRoot the submitted value is a Temporal.PlainDate.

mm
dd
yyyy

Picking a date and time

The type of the value sets the segments. A Temporal.PlainDateTime (or a placeholder of that type) adds hour and minute segments; granularity sets the smallest one ('day', 'hour', 'minute' or 'second'), and hour-cycle forces a 12 or 24 hour clock instead of the locale's. The calendar keeps the time of day when the user picks another day.

vue
<script setup lang="ts">
import { shallowRef } from 'vue'

const startsAt = shallowRef(Temporal.PlainDateTime.from('2026-11-04T09:30'))
</script>

<template>
  <DatePickerRoot
    v-model="startsAt"
    granularity="minute"
    :hour-cycle="24"
  >
    <!-- ... -->
  </DatePickerRoot>
</template>

In a time zone

With a Temporal.ZonedDateTime, the field shows the wall-clock time in the value's zone with the zone's name, and the value keeps its zone when the user picks another day. Set hide-time-zone to leave the zone name out of the field. Convert a value to show it in another zone: startsAt.withTimeZone('Europe/Paris'). See Time zones.

vue
<script setup lang="ts">
import { shallowRef } from 'vue'

const meeting = shallowRef(Temporal.ZonedDateTime.from('2026-11-04T15:00[America/New_York]'))
</script>

<template>
  <DatePickerRoot v-model="meeting" granularity="minute">
    <!-- ... -->
  </DatePickerRoot>
</template>

Closing on select

By default the calendar stays open after a date is picked, so the user can check the field before leaving. Set close-on-select to close it as soon as a date is picked; that close carries the reason 'date-select' in the update:open details.

vue
<template>
  <DatePickerRoot v-model="date" close-on-select>
    <!-- ... -->
  </DatePickerRoot>
</template>

Real-world examples

  • Date Picker View Switching: One Calendar with day, month and year views: click the heading to drill up, select a cell to drill back down.
  • Date Picker Selection: Date pickers let users select a date or a range of dates. They commonly use in booking systems.

Accessibility

Keyboard Interactions

KeyDescription
Tab
When focus moves onto the date field, focuses the first segment.
Space
When the focus is on either DatePickerNext or DatePickerPrev, it navigates the calendar. Otherwise, it selects the date. If the focus is on DatePickerTrigger, it opens/closes the popover.
Enter
When the focus is on either DatePickerNext or DatePickerPrev, it navigates the calendar. Otherwise, it selects the date. If the focus is on DatePickerTrigger, it opens/closes the popover.
ArrowLeftArrowRight
Navigates between the date field segments. If the focus is on the DatePickerCalendar, it navigates between the dates.
ArrowUpArrowDown
Increments/changes the value of the segment. If the focus is on the DatePickerCalendar, it navigates between the dates.
0-9
When the focus is on a numeric DatePickerInput, it types in the number and focuses the next segment if the next input would result in an invalid value.
Backspace
Deletes a digit from the focused numeric segments.
AP
When the focus is on the day period, it sets it to AM or PM.

Headless composable

useDatePicker owns the value, the placeholder, the open state and the calendar view, and returns getFieldProps() and getCalendarProps(): the options that make a useDateField and a useCalendar its field and its calendar. Positioning, the popover and focus management stay in the components. It registers watchers, so call it inside setup(). The composable is experimental; see Headless composables.