Select date
Aug 17, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
Date pickers let people select a date, or a range of dates, on a calendar or by typing it. Compose a DatePicker from its parts, and use a DateRangePicker to select a range of dates. The pickers have no built-in text: write the text of each part yourself, in your language.
To let people type a date without a calendar, use a date field.
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerDialog,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
DateRangePicker,
DateRangePickerCalendar,
DateRangePickerHeadline,
DateRangePickerInput,
DialogTrigger,
} from '@material-web/react'
import { parseDate } from '@internationalized/date'
import { Heading } from 'react-aria-components'Basic date picker
Write the parts of a DatePicker as its children, with their text. A picker is shown where it is written, and does not open on its own: to show it in a dialog, see Modal date picker.
Select date
Aug 17, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
import { parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
} from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function Basic() {
return (
<DatePicker defaultValue={parseDate('2025-08-17')}>
{({ displayMode }) => (
<>
<DatePickerHeader>
<Heading slot="title">Select date</Heading>
<DatePickerHeadline>
{displayMode === 'picker' ? 'Selected date' : 'Entered date'}
</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date" />
</DatePickerContent>
</>
)}
</DatePicker>
)
}A DatePicker selects one date, and a DateRangePicker a range of dates. Show either one in the page, as in the example above, or in a dialog:
| To show | Use |
|---|---|
| A picker in a dialog | A DatePickerDialog around the picker, with its buttons |
| A range picker | A DateRangePicker, in the page or in a DatePickerDialog |
| A full-screen range picker | A DateRangePicker in a dialog with isFullScreen |
Composition
A DatePicker is composed of these parts. It holds a DatePickerHeader and, under it, a DatePickerContent, which hold the others:
| Part | In | Use |
|---|---|---|
DatePickerHeader | DatePicker | The header |
Heading with slot="title" | DatePickerHeader | The title |
DatePickerHeadline | DatePickerHeader | Shows the selected date, or its children while no date is selected |
DatePickerModeToggle | DatePickerHeader | The button that switches between the calendar and the date input |
DatePickerContent | DatePicker | The content, under the header |
DatePickerCalendar | DatePickerContent | The calendar |
DatePickerInput | DatePickerContent | The date input. Set its label to label its field. |
Leave out the mode toggle, the calendar or the input to do without it. This picker has the calendar alone:
Select date
Aug 17, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
import { parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
} from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function CalendarOnly() {
return (
<DatePicker defaultValue={parseDate('2025-08-17')}>
<DatePickerHeader>
<Heading slot="title">Select date</Heading>
<DatePickerHeadline>Selected date</DatePickerHeadline>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
</DatePickerContent>
</DatePicker>
)
}The DatePickerCalendar is a calendar, and the DatePickerInput is a date field. Set their props on the picker. The props of React Aria's Calendar, or of its RangeCalendar on a DateRangePicker, apply to the calendar, and the value, the bounds and the disabled, read-only and invalid states apply to the input too. A DatePicker does not take visibleDuration.
Date range picker
Use a DateRangePicker to select a range of dates, such as the dates of a flight or of a hotel stay. Compose it the same way, with these parts in place of the headline, the calendar and the input:
| Part | Use |
|---|---|
DateRangePickerHeadline | Shows the selected range, or one end of it, or its children while neither end is selected |
DateRangePickerCalendar | Shows the months in a scrolling column |
DateRangePickerInput | Holds the start and end inputs. Set startLabel and endLabel to label their fields. |
The picker fills the height it is given: in this example, the height of the box it is in. Press two days to select a range.
Select dates
Start date – End dateAugust 2025
27 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
import { parseDate } from '@internationalized/date'
import {
DatePickerContent,
DatePickerHeader,
DatePickerModeToggle,
DateRangePicker,
DateRangePickerCalendar,
DateRangePickerHeadline,
DateRangePickerInput,
} from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function Range() {
return (
<div className="flex h-140 flex-col">
<DateRangePicker defaultFocusedValue={parseDate('2025-08-17')}>
{({ displayMode }) => (
<>
<DatePickerHeader>
<Heading slot="title">Select dates</Heading>
<DateRangePickerHeadline>
{displayMode === 'picker' ? 'Start date – End date' : 'Enter dates'}
</DateRangePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DateRangePickerCalendar />
<DateRangePickerInput startLabel="Start date" endLabel="End date" />
</DatePickerContent>
</>
)}
</DateRangePicker>
</div>
)
}In a DatePickerDialog, the months fill the dialog's height above the buttons. In this example, the confirm button is disabled until a range is selected.
import { parseDate } from '@internationalized/date'
import {
Button,
DatePickerContent,
DatePickerDialog,
DatePickerHeader,
DatePickerModeToggle,
DateRangePicker,
DateRangePickerCalendar,
DateRangePickerHeadline,
DateRangePickerInput,
DialogTrigger,
Icon,
type DatePickerRenderProps,
} from '@material-web/react'
import { useState } from 'react'
import { Heading, type DateValue, type RangeValue } from 'react-aria-components'
const parts = ({ displayMode }: DatePickerRenderProps) => (
<>
<DatePickerHeader>
<Heading slot="title">Select dates</Heading>
<DateRangePickerHeadline>
{displayMode === 'picker' ? 'Start date – End date' : 'Enter dates'}
</DateRangePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DateRangePickerCalendar />
<DateRangePickerInput startLabel="Start date" endLabel="End date" />
</DatePickerContent>
</>
)
export default function RangeModal() {
const [dates, setDates] = useState<RangeValue<DateValue> | null>({
start: parseDate('2025-08-17'),
end: parseDate('2025-08-23'),
})
const [picked, setPicked] = useState(dates)
return (
<DialogTrigger onOpenChange={(isOpen) => isOpen && setPicked(dates)}>
<Button variant="outlined">
<Icon name="date_range" />
{dates ? `${dates.start.toString()} – ${dates.end.toString()}` : 'Pick the dates'}
</Button>
<DatePickerDialog
clearButton={
<Button variant="text" onPress={() => setPicked(null)}>
Clear
</Button>
}
dismissButton={
<Button variant="text" slot="close">
Cancel
</Button>
}
confirmButton={
<Button variant="text" slot="close" isDisabled={!picked} onPress={() => setDates(picked)}>
OK
</Button>
}
>
<DateRangePicker value={picked} onChange={setPicked} autoFocus>
{parts}
</DateRangePicker>
</DatePickerDialog>
</DialogTrigger>
)
}Modal date picker
To show a picker in a dialog, put it in a DatePickerDialog. Pass the dialog's buttons as confirmButton and dismissButton, and add a clearButton if you want one. Open the dialog from your own button with a DialogTrigger, or with the dialog's isOpen.
The picker reports every selection through onChange. To keep the date unchanged until it is confirmed, hold the picked date in your own state and save it in the confirm button's onPress.
A button with slot="close" closes the dialog after its own onPress. Escape and a press outside the dialog close it too. Set isDismissable={false} to keep a press outside from closing it, and isKeyboardDismissDisabled to keep Escape from closing it.
import { parseDate } from '@internationalized/date'
import {
Button,
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerDialog,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
DialogTrigger,
Icon,
type DatePickerRenderProps,
} from '@material-web/react'
import { useState } from 'react'
import { Heading, type DateValue } from 'react-aria-components'
const parts = ({ displayMode }: DatePickerRenderProps) => (
<>
<DatePickerHeader>
<Heading slot="title">Select date</Heading>
<DatePickerHeadline>
{displayMode === 'picker' ? 'Selected date' : 'Entered date'}
</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date" />
</DatePickerContent>
</>
)
export default function Modal() {
const [date, setDate] = useState<DateValue | null>(parseDate('2025-08-17'))
const [picked, setPicked] = useState(date)
return (
<DialogTrigger onOpenChange={(isOpen) => isOpen && setPicked(date)}>
<Button variant="outlined">
<Icon name="calendar_today" />
{date ? date.toString() : 'Pick a date'}
</Button>
<DatePickerDialog
clearButton={
<Button variant="text" onPress={() => setPicked(null)}>
Clear
</Button>
}
dismissButton={
<Button variant="text" slot="close">
Cancel
</Button>
}
confirmButton={
<Button variant="text" slot="close" isDisabled={!picked} onPress={() => setDate(picked)}>
OK
</Button>
}
>
<DatePicker value={picked} onChange={setPicked} autoFocus>
{parts}
</DatePicker>
</DatePickerDialog>
</DialogTrigger>
)
}- The dialog places the dismiss button and then the confirm button at the end, under the picker, and the clear button at the start.
- The
Headingin thetitleslot of the picker'sDatePickerHeadernames the dialog. - Set
autoFocuson the picker to focus a day of the calendar, or the first segment of the input, when the dialog opens. - The dialog opens and closes with the same props as a dialog.
Slots
Header
- title
| Slot | Child | Use |
|---|---|---|
title | A Heading | The picker's title. In a DatePickerDialog, it names the dialog. |
Dialog
- close
| Slot | Child | Use |
|---|---|---|
close | Any button, such as the confirm and dismiss buttons | Closes the DatePickerDialog after its own onPress |
Controlled
Pass dates as CalendarDate objects from @internationalized/date, in value, defaultValue, minValue and maxValue. Set the initial date with defaultValue, or control it with value and onChange. onChange is called with the date when a day is selected or a date is typed, and with null while the input holds no date that can be selected.
Select date
Aug 17, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
import { parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
type DatePickerDisplayMode,
} from '@material-web/react'
import { useState } from 'react'
import { Heading, type DateValue } from 'react-aria-components'
export default function Controlled() {
const [value, setValue] = useState<DateValue | null>(parseDate('2025-08-17'))
const [displayMode, setDisplayMode] = useState<DatePickerDisplayMode>('picker')
return (
<div className="flex flex-col gap-space-200">
<DatePicker
value={value}
onChange={setValue}
displayMode={displayMode}
onDisplayModeChange={setDisplayMode}
>
<DatePickerHeader>
<Heading slot="title">Select date</Heading>
<DatePickerHeadline>No date</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date" />
</DatePickerContent>
</DatePicker>
<span className="px-space-300 text-body-md text-on-surface-variant">
{value ? value.toString() : 'null'}, {displayMode}
</span>
</div>
)
}The value of a DateRangePicker is a { start, end } pair of dates. Its onChange is called with the range once both ends are selected or typed, and with null while the inputs hold one end or none.
Display mode
The display mode is picker (the default), which shows the calendar, or input, which shows the date input. Set the initial mode with defaultDisplayMode, or control it with displayMode and onDisplayModeChange, which is called when the mode toggle switches the mode.
Pass a function as the picker's children to write text that follows the display mode, such as the mode toggle's aria-label. It is called with { displayMode }.
Each time the input is shown, it holds the selected date, or the ends of the range, or nothing: a date that was partly typed, or that could not be selected, is cleared. Each time the calendar is shown, it opens at the month of the selected date, or of the start of the range. With no date selected, it stays on the month it showed before.
Show the input first for a date in the distant past or future, such as a date of birth. In this example, defaultFocusedValue sets the month the calendar opens at while no date is selected.
Date of birth
Entered date31 | 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | 1 | 2 | 3 |
import { parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
} from '@material-web/react'
import { Heading } from 'react-aria-components'
export default function InputFirst() {
return (
<DatePicker defaultDisplayMode="input" defaultFocusedValue={parseDate('1990-01-01')}>
{({ displayMode }) => (
<>
<DatePickerHeader>
<Heading slot="title">Date of birth</Heading>
<DatePickerHeadline>
{displayMode === 'picker' ? 'Selected date' : 'Entered date'}
</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date of birth" />
</DatePickerContent>
</>
)}
</DatePicker>
)
}Month and year pickers
In the calendar, the month and year button opens a grid of years over the month, scrolled to the year shown. Shift+M and Shift+Y move the focus to the button. Escape in the years closes the years alone, not what is around the picker.
Clearing the value
Set the value to null to clear it: no day is selected, the input is empty, and the headline shows its children. A picker has no clear button of its own. In a DatePickerDialog, pass one as clearButton, as in the modal date picker.
Form props
Set isDisabled to disable a picker: its days, its month and year button and its input are dimmed and cannot be pressed or focused, and the selected day is not marked in the calendar. Set isReadOnly to keep the date as it is: the days and the input can be focused, but a press or a key changes nothing. The headline and the mode toggle stay as they are.
Disabled
Aug 17, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
Read-only
Aug 17, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
import { parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
type DatePickerRenderProps,
} from '@material-web/react'
import { Heading } from 'react-aria-components'
const parts =
(title: string) =>
({ displayMode }: DatePickerRenderProps) => (
<>
<DatePickerHeader>
<Heading slot="title">{title}</Heading>
<DatePickerHeadline>
{displayMode === 'picker' ? 'Selected date' : 'Entered date'}
</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date" />
</DatePickerContent>
</>
)
export default function FormProps() {
const date = parseDate('2025-08-17')
return (
<>
<DatePicker defaultValue={date} isDisabled>
{parts('Disabled')}
</DatePicker>
<DatePicker defaultValue={date} isReadOnly>
{parts('Read-only')}
</DatePicker>
</>
)
}Note: A picker takes no name. To include a date in a form, use a date field.
Validation
Set minValue and maxValue to limit the dates that can be selected. Days outside them are dimmed, and the previous and next buttons and the years stop at them. Pass isDateUnavailable to mark days as unavailable: they are struck out, and can be focused with the keyboard but not selected.
A typed date that is outside the bounds or unavailable stays in the input, marked as invalid, and makes the value null until a valid date replaces it.
Select a weekday
Aug 18, 202527 | 28 | 29 | 30 | 31 | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | 1 | 2 | 3 | 4 | 5 | 6 |
import { isWeekend, parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
} from '@material-web/react'
import { Heading, useLocale } from 'react-aria-components'
export default function Bounds() {
const { locale } = useLocale()
return (
<DatePicker
defaultValue={parseDate('2025-08-18')}
minValue={parseDate('2025-08-11')}
maxValue={parseDate('2025-10-31')}
isDateUnavailable={(date) => isWeekend(date, locale)}
>
{({ displayMode }) => (
<>
<DatePickerHeader>
<Heading slot="title">Select a weekday</Heading>
<DatePickerHeadline>
{displayMode === 'picker' ? 'Selected date' : 'Entered date'}
</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date" />
</DatePickerContent>
</>
)}
</DatePicker>
)
}Typed ranges
- A typed date that is outside the bounds, unavailable, or on the wrong side of the other end is not accepted. It stays in its input, marked as invalid, and the range is
nulluntil a valid date replaces it. - When the two dates are out of order, the one typed last is marked as invalid, with no error text.
- For the end date,
isDateUnavailableis called with the start date as its anchor. Unless you setallowsNonContiguousRanges, an end date after the next unavailable day is not accepted. - The inputs accept only dates within the months of the calendar: its
visibleDuration, which is 24 months by default, around the range or today. The months move when the keyboard focus goes past either end.
Full-screen
For a full-screen range picker, as on a phone, put the DateRangePicker in a dialog with isFullScreen, under your own bar that holds a close button and a Save button. A picker is 360dp wide: give it className="w-full" to fill the dialog. The days of each week then spread evenly across its width, and the months scroll to the bottom edge of the window.
import { parseDate } from '@internationalized/date'
import {
AppBar,
Button,
DatePickerContent,
DatePickerHeader,
DatePickerModeToggle,
DateRangePicker,
DateRangePickerCalendar,
DateRangePickerHeadline,
DateRangePickerInput,
Dialog,
DialogTrigger,
Icon,
IconButton,
type DatePickerRenderProps,
} from '@material-web/react'
import { useState } from 'react'
import { Heading, type DateValue, type RangeValue } from 'react-aria-components'
const parts = ({ displayMode }: DatePickerRenderProps) => (
<>
<DatePickerHeader>
<Heading slot="title">Select dates</Heading>
<DateRangePickerHeadline>
{displayMode === 'picker' ? 'Start date – End date' : 'Enter dates'}
</DateRangePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker' ? 'Switch to text input mode' : 'Switch to calendar mode'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DateRangePickerCalendar />
<DateRangePickerInput startLabel="Start date" endLabel="End date" />
</DatePickerContent>
</>
)
export default function FullScreen() {
const [dates, setDates] = useState<RangeValue<DateValue> | null>({
start: parseDate('2025-08-17'),
end: parseDate('2025-08-23'),
})
const [picked, setPicked] = useState(dates)
return (
<DialogTrigger onOpenChange={(isOpen) => isOpen && setPicked(dates)}>
<Button variant="outlined">
<Icon name="date_range" />
{dates ? `${dates.start.toString()} – ${dates.end.toString()}` : 'Pick the dates'}
</Button>
<Dialog isFullScreen className="bg-surface-container-high pb-0">
{({ state }) => (
<>
<AppBar className="bg-surface-container-high">
<IconButton slot="leading" aria-label="Close" onPress={() => state.close()}>
<Icon name="close" />
</IconButton>
<Button
slot="trailing"
variant="text"
isDisabled={!picked}
onPress={() => {
setDates(picked)
state.close()
}}
>
Save
</Button>
</AppBar>
<DateRangePicker value={picked} onChange={setPicked} className="w-full">
{parts}
</DateRangePicker>
</>
)}
</Dialog>
</DialogTrigger>
)
}Text and locale
The pickers have no built-in text. Write it in the parts: the title, the headline shown while no date is selected, the mode toggle's aria-label, the inputs' labels, and the text of the dialog's buttons. A part with no text shows none, but the mode toggle requires an aria-label.
The pickers format the dates for the locale: the headline's date or range, the month and year, the days of the week, and the input's segments and format. The previous and next buttons are named in the locale too (Previous and Next in English). To set a locale, wrap the picker in an I18nProvider from react-aria-components.
The locale also sets the calendar system (th-TH is Buddhist, ja-JP-u-ca-japanese has eras), the first day of the week, the names and digits of the days, months and years, and the direction the arrow keys move. The input's own error texts, such as Value must be 09/01/2025 or later., are in the browser's language, not the locale's. See Date field.
Sélectionner une date
17 août 202528 | 29 | 30 | 31 | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
import { parseDate } from '@internationalized/date'
import {
DatePicker,
DatePickerCalendar,
DatePickerContent,
DatePickerHeader,
DatePickerHeadline,
DatePickerInput,
DatePickerModeToggle,
} from '@material-web/react'
import { Heading, I18nProvider } from 'react-aria-components'
export default function Locale() {
return (
<I18nProvider locale="fr-FR">
<DatePicker defaultValue={parseDate('2025-08-17')}>
{({ displayMode }) => (
<>
<DatePickerHeader>
<Heading slot="title">Sélectionner une date</Heading>
<DatePickerHeadline>
{displayMode === 'picker' ? 'Date sélectionnée' : 'Date saisie'}
</DatePickerHeadline>
<DatePickerModeToggle
aria-label={
displayMode === 'picker'
? 'Passer à la saisie au clavier'
: 'Passer au calendrier'
}
/>
</DatePickerHeader>
<DatePickerContent>
<DatePickerCalendar />
<DatePickerInput label="Date" />
</DatePickerContent>
</>
)}
</DatePicker>
</I18nProvider>
)
}- A
DatePickerDialogis laid out in the locale's direction, unless you set itsdir. - A picker or a calendar outside a dialog follows the page's
dir. Make it agree with the locale, so that the days run in the direction the arrow keys move. - To change the calendar system, choose it in the locale (
th-TH-u-ca-gregory).createCalendarchanges the calendar but not the input.
Customization
Pass classes in className to restyle a picker: they apply to its outermost element, as style and ref do. A DatePickerHeader, a DatePickerContent and a DatePickerModeToggle take className too. See Styling for the classes, the states and the theme.
- Width: A picker is 360dp wide. Give it
className="w-full"to fill the element that holds it. - Height: A
DateRangePickerfills the height it is given, and its months scroll in it. - Months: A
DateRangePickerholds 24 months. SetvisibleDurationfor more or fewer, as invisibleDuration={{ months: 12 }}. - Calendar: To compose your own calendar, use the parts of the calendar. Its Layout section shows how
DatePickerCalendarcomposes them.
Use cases
Material lists what people should be able to do with assistive technology:
- Use multiple input methods, making it accessible to those using assistive technology
Interaction and style
- States: The days, the month and year button and the years show a state layer on hover and a ripple on a press. Keyboard focus shows a focus ring, and a press with a mouse or touch does not. Today is ringed, the selected day is filled, and an unavailable day is struck out.
- Touch target: Each day, each year, the month and year button, the previous and next buttons and the mode toggle have a 48dp touch target, as Material advises.
- Color contrast: With the default color roles, the days keep 4.5:1 contrast with the dialog's container in every scheme, the selected day too, as Material advises for dates.
- Density: The days, the years and the month and year button keep their size in every density.
- Motion: With reduced motion, the dialog opens and the months change at once, without sliding.
- Forced colors: In forced colors, the selected day and the band of a range are filled with the system's highlight color, the days past the bounds are grayed out, and the dialog keeps an edge.
- Right to left: In a right-to-left locale, the dialog is laid out right to left, and the arrow keys move along the days in that direction. See Text and locale.
- Date input: Material advises offering the date input in a modal date picker, behind the edit icon. Add a
DatePickerModeToggleand aDatePickerInput: over the calendar, the toggle shows the edit icon and switches to the input. - Clear button: A
DatePickerDialoghas a clear button only when you passclearButton. Material advises leaving it out where it is not needed, so that keyboard users have fewer tab stops.
Focus
- The dialog keeps the focus inside it while it is open, and gives it back to the button that opened it when it closes.
- Set
autoFocuson the picker to focus a day of the calendar, or the first segment of the input, when the dialog opens. - The days are a single tab stop. The arrow keys move the focus among them.
- Pressing the mode toggle moves the focus into the calendar or the input it switches to. The other one cannot be reached until it is shown.
- When the years close, the focus returns to the month and year button.
- The days, the month and year button and the input of a disabled picker cannot be focused. Those of a read-only picker can.
Keyboard navigation
| Keys | Actions |
|---|---|
| Tab | Move the focus to the next control, with the days as one stop |
| Left or Right arrow | Move the focus to the previous or next day |
| Up or Down arrow | Move the focus to the same day of the previous or next week |
| Page Up or Page Down | Move the focus to the same day of the previous or next month |
| Shift+Page Up or Shift+Page Down | Move the focus to the same day of the previous or next year |
| Home or End | Move the focus to the first or last day of the month |
| Space or Enter | Select the focused day, or the focused year |
| Arrow keys | Move the focus among the years, while they are open |
| Shift+M or Shift+Y | Move the focus to the month and year button |
| Escape | Close the years, or the dialog while the years are closed |
- Enter on a day selects it. It does not confirm the date or close the dialog.
- Set
isKeyboardDismissDisabledon theDatePickerDialogto keep Escape from closing it. - In the date input, the keys are those of a date field.
Labeling elements
- The picker's title names the dialog. To name it otherwise, set an
aria-labelon theDatePickerDialog. - The inputs are named by their labels:
label, orstartLabelandendLabel. - Give the mode toggle an
aria-label, which can follow the display mode, as in Display mode. - The previous and next buttons are named in the locale, Previous and Next in English. The month and year button is named by the month and year shown, such as August 2025, and reports whether the years are open. The years are a list box, the chosen year selected.
- Each day is named with its full date, as Material advises. See Calendar.
Set a picker's props on the DatePicker or the DateRangePicker. Calendar props, such as focusedValue, firstDayOfWeek and pageBehavior, apply to its calendar, and the value and the bounds apply to its input too. className, style and ref apply to the picker's outermost element.
DatePicker
displayMode'input' | 'picker'Don’t use a modal date picker to prompt for dates in the distant past or future, such as a date of birth. In these cases, use a modal input picker or a docked date picker instead.
Modal date inputs allow the manual entry of dates using the numbers on a keyboard. People can input a date or a range of dates in a dialog.
For dates that don’t require a calendar view, the modal date input can be the default view
Props of DatePicker (30)
createCalendar(identifier: CalendarIdentifier) => ICalendarA function to create a new Calendar object for a given calendar identifier. If not provided, the
createCalendarfunction from@internationalized/datewill be used.idstringThe element's unique identifier. See MDN.
aria-labelstringDefines a string value that labels the current element.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.
isDisabledbooleanDefaultfalseWhether the calendar is disabled.
autoFocusbooleanDefaultfalseWhether to automatically focus the calendar when it mounts.
onFocusChange(date: CalendarDate) => voidHandler that is called when the focused date changes.
valuenull | ZonedDateTime | CalendarDate | CalendarDateTimeThe current value (controlled).
selectionMode'single'Default'single'Whether single or multiple selection is enabled.
isDateUnavailable(date: DateValue) => booleanCallback that is called for each date of the calendar. If it returns true, then the date is unavailable.
minValueDateValue | nullThe minimum allowed date that a user may select.
maxValueDateValue | nullThe maximum allowed date that a user may select.
isReadOnlybooleanDefaultfalseWhether the calendar value is immutable.
focusedValueDateValue | nullControls the currently focused date within the calendar.
defaultFocusedValueDateValue | nullThe date that is focused when the calendar first mounts (uncontrolled).
isInvalidbooleanWhether the current selection is invalid according to application logic.
pageBehavior'single' | 'visible'DefaultvisibleControls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.
firstDayOfWeek'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'The day that starts the week.
selectionAlignment'center' | 'start' | 'end'Default'center'Determines the alignment of the visible months on initial render based on the current selection or current date if there is no selection.
weeksInMonthnumberThe number of weeks in a month. This overrides the default set by the locale.
defaultValuenull | ZonedDateTime | CalendarDate | CalendarDateTimeThe default value (uncontrolled).
renderDOMRenderFunction<'div', CalendarRenderProps<'single'>>Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components.
Requirements:
- You must render the expected element type (e.g. if
<button>is expected, you cannot render an<a>). - Only a single root DOM element can be rendered (no fragments).
- You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
- You must render the expected element type (e.g. if
slotstring | nullA slot name for the component. Slots allow the component to receive props from a parent component. An explicit
nullvalue indicates that the local props completely override all props received from a parent.refRef<HTMLDivElement>onChange(value: MappedDateValue<T> | null) => voidHandler that is called when the value changes.
defaultDisplayMode'input' | 'picker'onDisplayModeChange(displayMode: DatePickerDisplayMode) => voidchildrenReactNode | ((values: DatePickerRenderProps) => ReactNode)
DatePicker also takes the 72 attributes and events of the element it renders.
DateRangePicker
displayMode'input' | 'picker'Don’t use a modal date picker to prompt for dates in the distant past or future, such as a date of birth. In these cases, use a modal input picker or a docked date picker instead.
Modal date inputs allow the manual entry of dates using the numbers on a keyboard. People can input a date or a range of dates in a dialog.
For dates that don’t require a calendar view, the modal date input can be the default view
Props of DateRangePicker (32)
visibleDurationDateDurationDefault{ months: 1 }The amount of days that will be displayed at once. This affects how pagination works.
createCalendar(identifier: CalendarIdentifier) => ICalendarA function to create a new Calendar object for a given calendar identifier. If not provided, the
createCalendarfunction from@internationalized/datewill be used.idstringThe element's unique identifier. See MDN.
aria-labelstringDefines a string value that labels the current element.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.
isDisabledbooleanDefaultfalseWhether the calendar is disabled.
autoFocusbooleanDefaultfalseWhether to automatically focus the calendar when it mounts.
onFocusChange(date: CalendarDate) => voidHandler that is called when the focused date changes.
valuenull | RangeValue<T>The current value (controlled).
isDateUnavailable(date: DateValue, anchorDate: CalendarDate | null) => booleanCallback that is called for each date of the calendar. If it returns true, then the date is unavailable. The second argument provides the current selection anchor date, if any. This can be used to adjust the available dates based on the user's first selected date.
minValueDateValue | nullThe minimum allowed date that a user may select.
maxValueDateValue | nullThe maximum allowed date that a user may select.
isReadOnlybooleanDefaultfalseWhether the calendar value is immutable.
focusedValueDateValue | nullControls the currently focused date within the calendar.
defaultFocusedValueDateValue | nullThe date that is focused when the calendar first mounts (uncontrolled).
isInvalidbooleanWhether the current selection is invalid according to application logic.
pageBehavior'single' | 'visible'DefaultvisibleControls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.
firstDayOfWeek'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'The day that starts the week.
selectionAlignment'center' | 'start' | 'end'Default'center'Determines the alignment of the visible months on initial render based on the current selection or current date if there is no selection.
weeksInMonthnumberThe number of weeks in a month. This overrides the default set by the locale.
defaultValuenull | RangeValue<T>The default value (uncontrolled).
commitBehavior'select' | 'reset' | 'clear'Default'select'Controls the behavior when a pointer is released outside the calendar or a blur occurs mid selection:
clear: clear the currently selected range of dates.reset: reset the selection to the previously selected range of dates.select: select the currently hovered range of dates.
allowsNonContiguousRangesbooleanWhen combined with
isDateUnavailable, determines whether non-contiguous ranges, i.e. ranges containing unavailable dates, may be selected.renderDOMRenderFunction<'div', RangeCalendarRenderProps>Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components.
Requirements:
- You must render the expected element type (e.g. if
<button>is expected, you cannot render an<a>). - Only a single root DOM element can be rendered (no fragments).
- You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
- You must render the expected element type (e.g. if
slotstring | nullA slot name for the component. Slots allow the component to receive props from a parent component. An explicit
nullvalue indicates that the local props completely override all props received from a parent.refRef<HTMLDivElement>defaultDisplayMode'input' | 'picker'onDisplayModeChange(displayMode: DatePickerDisplayMode) => voidonChange(value: RangeValue<MappedDateValue<T>> | null) => voidchildrenReactNode | ((values: DatePickerRenderProps) => ReactNode)
DateRangePicker also takes the 72 attributes and events of the element it renders.
DatePickerDialog
confirmButtonrequiredReactNodeTo exit a date picker, the input can either be confirmed (OK) or dismissed (Cancel).
Props of DatePickerDialog (22)
classNameClassNameOrFunction<ModalRenderProps>Default'react-aria-ModalOverlay'The CSS className for the element. A function may be provided to compute the class based on component state.
isEnteringbooleanWhether the modal is currently performing an entry animation.
isExitingbooleanWhether the modal is currently performing an exit animation.
onEnter(element: HTMLElement) => void | Promise<void>Callback when the modal starts entering. Return a promise to indicate when the entry animation has completed.
onExit(element: HTMLElement) => void | Promise<void>Callback when the modal starts exiting. Return a promise to indicate when the exit animation has completed.
UNSTABLE_portalContainerdeprecatedElementDefaultdocument.bodyThe container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.
UNSTABLE_deferUntilEnteredbooleanWhether to wait until the entry animation completes before hiding content outside the modal and moving focus into it.
isDismissablebooleanDefaultfalseWhether to close the modal when the user interacts outside it.
isKeyboardDismissDisabledbooleanDefaultfalseWhether pressing the escape key to close the modal should be disabled.
UNSTABLE_overrideFocusbooleanWhether to override the
focus()method so it does not scroll the page. This is temporary and will be removed after fully testing all overlays.shouldCloseOnInteractOutside(element: Element) => booleanWhen user interacts with the argument element outside of the overlay ref, return true if onClose should be called. This gives you a chance to filter out interaction with elements that should not dismiss the overlay. By default, onClose will always be called on interaction outside the overlay ref.
isOpenbooleanWhether the overlay is open by default (controlled).
defaultOpenbooleanWhether the overlay is open by default (uncontrolled).
onOpenChange(isOpen: boolean) => voidHandler that is called when the overlay's open state changes.
childrenChildrenOrFunction<T>The children of the component. A function may be provided to alter the children based on component state.
styleCSSProperties | (values: ModalRenderProps & { defaultStyle: CSSProperties; }) => CSSProperties | undefinedThe inline style for the element. A function may be provided to compute the style based on component state.
renderDOMRenderFunction<'div', ModalRenderProps>Overrides the default DOM element with a custom render function. This allows rendering existing components with built-in styles and behaviors such as router links, animation libraries, and pre-styled components.
Requirements:
- You must render the expected element type (e.g. if
<button>is expected, you cannot render an<a>). - Only a single root DOM element can be rendered (no fragments).
- You must pass through props and ref to the underlying DOM element, merging with your own prop as appropriate.
- You must render the expected element type (e.g. if
slotstring | nullA slot name for the component. Slots allow the component to receive props from a parent component. An explicit
nullvalue indicates that the local props completely override all props received from a parent.aria-labelstringDefines a string value that labels the current element.
refRef<HTMLDivElement>dismissButtonReactNodeclearButtonReactNode
DatePickerDialog also takes the 70 attributes and events of the element it renders.
DatePickerHeader
Takes className, style and children.
DatePickerHeader also takes the 3 attributes and events of the element it renders.
DatePickerHeadline
Its children are shown while no date is selected.
Props of DatePickerHeadline (1)
childrenReactNode
DateRangePickerHeadline
Its children are shown while neither end of the range is selected.
Props of DateRangePickerHeadline (1)
childrenReactNode
DatePickerModeToggle
Takes the props of an icon button, except children and onPress.
variant'filled' | 'tonal' | 'outlined' | 'standard'Default'standard'There are four icon button color styles, in order of emphasis: filled, tonal, outlined, standard
For the highest emphasis, use the filled style. For the lowest emphasis, use standard.
filled: Use the filled style for visual impact and key actions that require high emphasis. Avoid overusing the filled style on a screen. Use them sparingly.tonal: Use the tonal style as a middle ground between filled and outlined icon buttons. It’s useful for secondary actions paired with a high emphasis action.outlined: Use the outlined style for medium-emphasis buttons. It’s useful when the button isn’t the main focus of the interaction, such as browsing through sets of cards.standard: Use the standard style for low-emphasis buttons, or when placing buttons on a colorful surface.
size's' | 'xs' | 'm' | 'l' | 'xl'Default's'Icon buttons are available in five different sizes:
- Extra small - 32dp
- Small - 40dp (default)
- Medium - 56dp
- Large - 96dp
- Extra large - 136dp
width'narrow' | 'default' | 'wide'Default'default'Three widths: narrow, default, and wide
Container widths in dp:
- XS: narrow 28, default 32, wide 40
- S: narrow 32, default 40, wide 52
- M: narrow 48, default 56, wide 72
- L: narrow 64, default 96, wide 128
- XL: narrow 104, default 136, wide 184
shape'round' | 'square'Default'round'Two shapes: round and square
Corner sizes of a square button: XS 12dp, S 12dp, M 16dp, L 28dp, XL 28dp.
In addition to changing shape when pressed, toggle icon buttons also change the resting shape from round (unselected) to square (selected) by default. If the resting shape is square, the selected shape should be round.
hasShapeMorphbooleanDefaultfalseShape morphs when pressed
While pressed, icon buttons can morph to become more square. Both round and square icon buttons should have the same pressed shape radius.
Corner sizes of the pressed state: XS 8dp, S 8dp, M 12dp, L 16dp, XL 16dp.
aria-labelstringDefines a string value that labels the current element.
isPendingbooleanWhether the button is in a pending state. This disables press and hover events while retaining focusability, and announces the pending state to screen readers.
Props of DatePickerModeToggle (47)
formstringThe
<form>element to associate the button with. The value of this attribute must be the id of a<form>in the same document. See MDN.idstringThe element's unique identifier. See MDN.
aria-labelledbystringIdentifies the element (or elements) that labels the current element.
aria-describedbystringIdentifies the element (or elements) that describes the object.
aria-detailsstringIdentifies the element (or elements) that provide a detailed, extended description for the object.
onClick(e: MouseEvent<FocusableElement>) => voidNot recommended – use
onPressinstead.onClickis an alias foronPressprovided for compatibility with other libraries.onPressprovides additional event details for non-mouse interactions.isDisabledbooleanWhether the button is disabled.
onPressStart(e: PressEvent) => voidHandler that is called when a press interaction starts.
onPressEnd(e: PressEvent) => voidHandler that is called when a press interaction ends, either over the target or when the pointer leaves the target.
onPressChange(isPressed: boolean) => voidHandler that is called when the press state changes.
onPressUp(e: PressEvent) => voidHandler that is called when a press is released over the target, regardless of whether it started on the target or not.
autoFocusbooleanWhether the element should receive focus on render.
onFocus(e: FocusEvent<Target>) => voidHandler that is called when the element receives focus.
onBlur(e: FocusEvent<Target>) => voidHandler that is called when the element loses focus.
onFocusChange(isFocused: boolean) => voidHandler that is called when the element's focus status changes.
onKeyDown(e: KeyboardEvent) => voidHandler that is called when a key is pressed.
onKeyUp(e: KeyboardEvent) => voidHandler that is called when a key is released.
hrefstringA URL to link to if elementType="a".
targetstringThe target window for the link.
relstringThe relationship between the linked resource and the current page. See MDN.
elementType(props: any) => ReactNode | Promise<ReactNode> | new (props: any, context: any) => Component<any, any, any> | 'button'Default'button'The HTML element or React element used to render the button, e.g. 'div', 'a', or
RouterLink.aria-disabled'true' | 'false' | booleanIndicates whether the element is disabled to users of assistive technology.
aria-expanded'true' | 'false' | booleanIndicates whether the element, or another grouping element it controls, is currently expanded or collapsed.
aria-haspopup'dialog' | 'menu' | 'true' | 'false' | 'grid' | 'listbox' | 'tree' | booleanIndicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.
aria-controlsstringIdentifies the element (or elements) whose contents or presence are controlled by the current element.
aria-pressed'true' | 'false' | 'mixed' | booleanIndicates the current "pressed" state of toggle buttons.
aria-current'time' | 'true' | 'false' | 'page' | 'step' | 'location' | 'date' | booleanIndicates whether this element represents the current item within a container or set of related elements.
type'button' | 'submit' | 'reset'Default'button'The behavior of the button when used in an HTML form.
preventFocusOnPressbooleanWhether to prevent focus from moving to the button when pressing it.
Caution, this can make the button inaccessible and should only be used when alternative keyboard interaction is provided, such as ComboBox's MenuTrigger or a NumberField's increment/decrement control.
formActionButtonHTMLAttributes<HTMLButtonElement>['formAction']The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner.
formEncTypestringIndicates how to encode the form data that is submitted.
formMethodstringIndicates the HTTP method used to submit the form.
formNoValidatebooleanIndicates that the form is not to be validated when it is submitted.
formTargetstringOverrides the target attribute of the button's form owner.
namestringSubmitted as a pair with the button's value as part of the form data.
valuestringThe value associated with the button's name when it's submitted with the form data.
excludeFromTabOrderbooleanWhether to exclude the element from the sequential tab order. If true, the element will not be focusable via the keyboard by tabbing. This should be avoided except in rare scenarios where an alternative means of accessing the element or its functionality via the keyboard is available.
onHoverStart(e: HoverEvent) => voidHandler that is called when a hover interaction starts.
onHoverEnd(e: HoverEvent) => voidHandler that is called when a hover interaction ends.
onHoverChange(isHovering: boolean) => voidHandler that is called when the hover state changes.
slotstring | nullA slot name for the component. Slots allow the component to receive props from a parent component. An explicit
nullvalue indicates that the local props completely override all props received from a parent.refRef<HTMLButtonElement & Element>classNameClassNameOrFunction<ButtonRenderProps>styleStyleOrFunction<ButtonRenderProps>isSelecteddefaultSelectedonChange
DatePickerContent
Takes className, style and children.
DatePickerContent also takes the 3 attributes and events of the element it renders.
DatePickerCalendar
Takes no props. Set the calendar's props on the DatePicker.
DatePickerInput
Shows a date field with no supporting text.
labelReactNodeThe text field's accessibility label should clearly state the purpose of the input (for example, event date or reservation date) and should match the placeholder text when the field is empty.
DateRangePickerCalendar
Takes no props. Set the calendar's props on the DateRangePicker.
DateRangePickerInput
Shows a date field for each end of the range, with no supporting text.
Props of DateRangePickerInput (2)
startLabelDateFieldProps<DateValue>['label']endLabelDateFieldProps<DateValue>['label']