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 | string Optional style overrides for the anchor. Ignored if a custom anchor is used. | |
disabled | false | boolean Control whether the datepicker is disabled or not. |
confirmation | false | boolean Control whether the user needs to press a button to apply their changes. If |
confirmUnsavedClose | false | boolean Control whether the user should confirm their changes if they exit the picker without saving.
If |
compressedHeader | false | boolean Show a smaller header with month/year dropdowns. |
dateFormat | short | string Control how the selection will be displayed in the anchor. |
disableWeekends | false | boolean If |
iconPlacement | start | IconPlacement Control where the calendar icon will display on the anchor. |
maxDate | Date The maximum date the user can select. This is inclusive - the user can select the
| |
minDate | Date The minimum date the user can select. This is inclusive - the user can select the
| |
showInputs | true | boolean Control whether inputs are shown inside the picker. Inputs are not
shown when |
showTodayButton | true | boolean Control 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 | boolean Control 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 | DayOfWeek Determine the day of the week that is shown in the first column when displaying a month. |
placeholder | Choose date... | string Placeholder string when there is no selection. |
fieldName | string The 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 | boolean Determines 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) => void A callback which is called whenever the overlay is currently open and a "close" or "submit" gesture is detected. | |
onOpen | (gesture: OpenGesture) => void A callback which is called whenever the overlay is currently closed and an "open gesture" is detected. | |
value Required | Date | Date[] | RangeSelection Current value of the picker. | |
anchoredOverlayProps | DatePickerAnchoredOverlayProps Props 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 |