Datepicker
A simple and reusable component to work with or select a date or a range of dates.
Accessibility
- Supports keyboard hotkeys:
tab
- to switch between inputs, arrows, monthyear select and day grid.escape
to close datepicker dropdown. - When month and year selects focused,
up
anddown
causes dropdown to open and move to value,enter
andspace
to choose selected year or month. - When day grid is focused,
left
,down
right
andup
to move through the grid days.Enter
to pick date. - When left or right arrow is focused,
enter
causes the same as click on this arrow. - Accessibility best practices for this component (
aria-valuenow
,aria-valuetext
,aria-valuemin
,aria-valuemax
,role=datepicker
).
Composed range pickers
Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Press the down arrow key to interact with the calendar and select a date. Press the escape button to close the calendar.
Overrides
Additionally, you can fully customize any part of the Datepicker through the overrides prop. The Datepicker consists of multiple subcomponents that are listed bellow and you can override each one of them. To help you identify the names of these subcomponents, you can highlight them through this selector:
Note: You should always use longhand CSS properties. Mixing shorthands and longhands will lead into strange behaviors!
Calendar API
Warning
any
= "Prop types are not shown in dev mode"
extract-react-types is not being run in dev mode for speed reasons. If you need to
see prop types add the environment variable FORCE_EXTRACT_REACT_TYPES
eg:
FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>
FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>
Datepicker API
Warning
any
= "Prop types are not shown in dev mode"
extract-react-types is not being run in dev mode for speed reasons. If you need to
see prop types add the environment variable FORCE_EXTRACT_REACT_TYPES
eg:
FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>
FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>
TimePicker API
Warning
any
= "Prop types are not shown in dev mode"
extract-react-types is not being run in dev mode for speed reasons. If you need to
see prop types add the environment variable FORCE_EXTRACT_REACT_TYPES
eg:
FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>
FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>
TimezonePicker API
Warning
any
= "Prop types are not shown in dev mode"
extract-react-types is not being run in dev mode for speed reasons. If you need to
see prop types add the environment variable FORCE_EXTRACT_REACT_TYPES
eg:
FORCE_EXTRACT_REACT_TYPES=true yarn start <packageName>
FORCE_EXTRACT_REACT_TYPES=true yarn start:<team>