DatePicker
DatePicker allows for the selection of dates, supporting single, multiple and range of dates.
Internal Component
This component is intended solely for use within GitHub and is not available for external use.Props
DatePicker
| Name | Default | Description |
|---|---|---|
anchor | "button" | AnchorVariant | RenderAnchor | React.RefObject<HTMLElement>The anchor is the inline element that the user will interact with to trigger the datepicker. Built-in anchors include:
To use a custom anchor, either provide a render function here or provide a |
anchorClassName | stringOptional style overrides for the anchor. Ignored if a custom anchor is used. | |
disabled | false | booleanControl whether the datepicker is disabled or not. |
confirmation | false | booleanControl whether the user needs to press a button to apply their changes. If |
confirmUnsavedClose | false | booleanControl whether the user should confirm their changes if they exit the picker without saving.
If |
compressedHeader | false | booleanShow a smaller header with month/year dropdowns. |
dateFormat | short | stringControl how the selection will be displayed in the anchor. |
disableWeekends | false | booleanIf |
iconPlacement | start | IconPlacementControl where the calendar icon will display on the anchor. |
maxDate | DateThe maximum date the user can select. This is inclusive - the user can select the
| |
minDate | DateThe minimum date the user can select. This is inclusive - the user can select the
| |
showInputs | true | booleanControl whether inputs are shown inside the picker. Inputs are not
shown when |
showTodayButton | true | booleanControl whether to show a 'today' button in the picker. This button will cause today's
date to appear and be focused. If today's date is outside the allowed range (defined by
|
showClearButton | false | booleanControl whether to show a 'clear' button in the picker. This button will set the
date to |
view | 1-month | "1-month" | "2-month"Control the size of the datepicker. Will always be |
weekStartsOn | Sunday | DayOfWeekDetermine the day of the week that is shown in the first column when displaying a month. |
placeholder | Choose date... | stringPlaceholder string when there is no selection. |
fieldName | stringThe name of the field that this datepicker is associated with. This is used in the aria-label, otherwise defaults to "Date" | |
onChange | ((selection: Date) => void) | ((selection: Date[]) => void) | ((selection: RangeSelection) => void)Called when the selection changes. For | |
open | booleanDetermines whether the overlay portion of the component should be shown or not. If not defined, the date picker will manage its own internal closed/open state. | |
onClose | (gesture: CloseGesture | SubmitGesture) => voidA callback which is called whenever the overlay is currently open and a "close" or "submit" gesture is detected. | |
onOpen | (gesture: OpenGesture) => voidA callback which is called whenever the overlay is currently closed and an "open gesture" is detected. | |
value Required | Date | Date[] | RangeSelectionCurrent value of the picker. | |
anchoredOverlayProps | DatePickerAnchoredOverlayPropsProps to be spread on the internal | |
configuration | Partial<BaseDatePickerConfig> | Partial<MultiDatePickerConfig> | Partial<RangeDatePickerConfig>Configuration object, if you'd like to reuse a single configuration object among multiple pickers.
These can also be supplied as top-level props. If any top-level props conflict with the
| |
variant Required |