A date field where the user types a date or selects one in a calendar. The calendar opens in a dropdown or in a dialog.
- Element
-
igc-date-picker
- Slots
-
prefix— Renders content before the input. -
suffix— Renders content after the input. -
helper-text— Renders content below the input. -
bad-input— Renders content when the value is in the `disabledDates` ranges. -
value-missing— Renders content when the required validation fails. -
range-overflow— Renders content when the max validation fails. -
range-underflow— Renders content when the min validation fails. -
custom-error— Renders content when a custom message is set with `setCustomValidity()`. -
invalid— Renders content when the component is in invalid state (validity.valid = false). -
title— Renders content in the calendar title. It applies only in `dialog` mode. -
header-date— Renders content instead of the current date in the calendar header. It applies only in `dialog` mode. -
clear-icon— Renders the icon of the clear button. -
calendar-icon— Renders the icon/content for the calendar picker. -
calendar-icon-open— Renders the icon/content for the picker in open state. -
actions— Renders content in the action part of the picker in open state.
- CSS Parts
-
label— The label wrapper that renders content above the target input. -
container— The main wrapper that holds all main input elements. -
input— The native input element. -
prefix— The prefix wrapper. -
suffix— The suffix wrapper. -
calendar-icon— The calendar icon wrapper for closed state. -
calendar-icon-open— The calendar icon wrapper for opened state. -
clear-icon— The clear icon wrapper. -
actions— The actions wrapper. -
helper-text— The helper-text wrapper that renders content below the target input. -
header— The calendar header element. -
header-title— The calendar header title element. -
header-date— The calendar header date element. -
calendar-content— The calendar content element which contains the views and navigation elements. -
navigation— The calendar navigation container element. -
months-navigation— The calendar months navigation button element. -
years-navigation— The calendar years navigation button element. -
years-range— The calendar years range element. -
navigation-buttons— The calendar navigation buttons container. -
navigation-button— The calendar previous/next navigation button. -
days-view-container— The calendar days view container element. -
days-view— The calendar days view element. -
months-view— The calendar months view element. -
years-view— The calendar years view element. -
days-row— The calendar days row element. -
months-row— The calendar months row element. -
years-row— The calendar years row element. -
calendar-label— The calendar week header label element. -
calendar-label-inner— The calendar week header label inner element. -
week-number— The calendar week number element. -
week-number-inner— The calendar week number inner element. -
date— The calendar date element. -
date-inner— The calendar date inner element. -
first— The calendar first selected date element in range selection. -
last— The calendar last selected date element in range selection. -
inactive— The calendar inactive date element. -
hidden— The calendar hidden date element. -
weekend— The calendar weekend date element. -
range— The calendar range selected element. -
special— The calendar special date element. -
disabled— The calendar disabled date element. -
single— The calendar single selected date element. -
preview— The calendar range selection preview date element. -
month— The calendar month element. -
month-inner— The calendar month inner element. -
year— The calendar year element. -
year-inner— The calendar year inner element. -
selected— The calendar selected state for element(s). Applies to date, month and year elements. -
current— The calendar current state for element(s). Applies to date, month and year elements. -
dialog-base— The base of the dialog in dialog mode. Style the backdrop with `::part(dialog-base)::backdrop`. -
title— The title of the dialog in dialog mode. -
footer— The footer of the dialog in dialog mode.
Properties
Section titled "Properties"disabled
Section titled "disabled"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the control is disabled. A disabled control is not validated, and the form does not submit its value.
disabled: boolean Defined in src/internals/mixins/forms/types.ts:35
disabledDates
Section titled "disabledDates"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The date ranges that the user cannot select in the calendar. A value that includes one of these dates is invalid.
disabledDates: DateRangeDescriptor[] = [] Defined in src/components/date-picker/date-picker.base.ts:396
headerOrientation
Section titled "headerOrientation"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The orientation of the calendar header. It applies only in dialog mode.
headerOrientation: CalendarHeaderOrientation = 'horizontal' Defined in src/components/date-picker/date-picker.base.ts:435
hideHeader
Section titled "hideHeader"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the calendar hides its header. In dropdown mode, the header is always hidden.
hideHeader: boolean = false Defined in src/components/date-picker/date-picker.base.ts:451
hideOutsideDays
Section titled "hideOutsideDays"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the calendar hides the dates that do not belong to the current month.
hideOutsideDays: boolean = false Defined in src/components/date-picker/date-picker.base.ts:459
invalid
Section titled "invalid"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the control shows the invalid state. It changes only the visual state, not the validity.
invalid: boolean Defined in src/internals/mixins/forms/types.ts:43
keepOpenOnOutsideClick
Section titled "keepOpenOnOutsideClick"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the component stays open when the user clicks outside of it.
keepOpenOnOutsideClick: boolean = false Defined in src/internals/bases/combo-box.ts:170
keepOpenOnSelect
Section titled "keepOpenOnSelect"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the component stays open after the user selects an item.
keepOpenOnSelect: boolean = false Defined in src/internals/bases/combo-box.ts:158
label
Section titled "label"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The label of the picker.
label: string Defined in src/components/date-picker/date-picker.base.ts:315
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the calendar opens in a dropdown or in a modal dialog.
In dialog mode, the user cannot type in the input.
mode: PickerMode = 'dropdown' Defined in src/components/date-picker/date-picker.base.ts:284
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The name of the control, submitted with the form data.
name: string Defined in src/internals/mixins/forms/types.ts:49
nonEditable
Section titled "nonEditable"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the user cannot type in the input. The user can still select a date in the calendar.
nonEditable: boolean = false Defined in src/components/date-picker/date-picker.base.ts:300
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the component is open.
open: boolean = false Defined in src/internals/bases/combo-box.ts:50
orientation
Section titled "orientation"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The orientation of the multiple months displayed in the calendar's days view.
orientation: ContentOrientation = 'horizontal' Defined in src/components/date-picker/date-picker.base.ts:443
outlined
Section titled "outlined"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the control has an outlined appearance.
outlined: boolean = false Defined in src/components/date-picker/date-picker.base.ts:308
prompt
Section titled "prompt"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The prompt symbol to use for unfilled parts of the mask.
prompt: string = '_' Defined in src/components/date-picker/date-picker.base.ts:323
readOnly
Section titled "readOnly"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the control is read-only. The user cannot change the value or open the calendar.
readOnly: boolean = false Defined in src/components/date-picker/date-picker.base.ts:292
scrollStrategy
Section titled "scrollStrategy"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The behavior of the component when a parent container scrolls.
If the value is hide, the component hides while the anchor is fully out
of view. hide is the default value.
If the value is scroll, the component stays visible and anchored.
If the value is close, the component closes on each scroll.
scrollStrategy: PopoverScrollStrategy = 'hide' Defined in src/internals/bases/combo-box.ts:65
showWeekNumbers
Section titled "showWeekNumbers"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the calendar shows the week numbers.
showWeekNumbers: boolean = false Defined in src/components/date-picker/date-picker.base.ts:467
specialDates
Section titled "specialDates"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The date ranges that the calendar marks as special.
specialDates: DateRangeDescriptor[] Defined in src/components/date-picker/date-picker.base.ts:400
tagName
Section titled "tagName"The tagName read-only property of the Element interface returns the tag name of the element on which it's called.
tagName: "igc-date-picker" = 'igc-date-picker' Accessors
Section titled "Accessors"activeDate
Section titled "activeDate"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get activeDate(): any Defined in src/components/date-picker/date-picker.base.ts:407
The date that the calendar shows and highlights. Without it, the calendar starts at the value, or at the current date when there is no value.
set activeDate(value: string | Date | null | undefined): void Defined in src/components/date-picker/date-picker.base.ts:407
Parameters
- value:
string | Date | null | undefined
Returns void
defaultValue
Section titled "defaultValue"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get defaultValue(): any Defined in src/internals/mixins/forms/types.ts:158
The default value of the control. A form reset restores the value to it.
While the value is unchanged since the start or the last form reset, a new
default also sets the value. The value attribute also sets it.
set defaultValue(value: unknown): void Defined in src/internals/mixins/forms/types.ts:158
Parameters
- value:
unknown
Returns void
displayFormat
Section titled "displayFormat"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get displayFormat(): any Defined in src/components/date-picker/date-picker.base.ts:331
The format of the value while the input does not have focus.
Without it, the input uses inputFormat when set, else the display format of the locale.
set displayFormat(value: string): void Defined in src/components/date-picker/date-picker.base.ts:331
Parameters
- value:
string
Returns void
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The form that the control is associated with, or null.
get form(): HTMLFormElement | null Defined in src/internals/mixins/forms/types.ts:52
Returns HTMLFormElement | null
inputFormat
Section titled "inputFormat"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get inputFormat(): any Defined in src/components/date-picker/date-picker.base.ts:345
The date format of the input while the user edits the value. Without it, the input uses the input format of the locale.
set inputFormat(value: string): void Defined in src/components/date-picker/date-picker.base.ts:345
Parameters
- value:
string
Returns void
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get max(): any Defined in src/components/date-picker/date-picker.base.ts:375
The maximum value required for the picker to remain valid. The calendar disables the dates after it.
set max(value: string | Date | null | undefined): void Defined in src/components/date-picker/date-picker.base.ts:375
Parameters
- value:
string | Date | null | undefined
Returns void
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get min(): any Defined in src/components/date-picker/date-picker.base.ts:359
The minimum value required for the picker to remain valid. The calendar disables the dates before it.
set min(value: string | Date | null | undefined): void Defined in src/components/date-picker/date-picker.base.ts:359
Parameters
- value:
string | Date | null | undefined
Returns void
required
Section titled "required"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get required(): any Defined in src/internals/mixins/forms/types.ts:188
Whether the control is required. A required control that has no value, or is not checked, fails validation.
set required(value: boolean): void Defined in src/internals/mixins/forms/types.ts:188
Parameters
- value:
boolean
Returns void
selectionEnd
Section titled "selectionEnd"The offset of the end of the text selection in the input, in UTF-16 code units.
get selectionEnd(): number Defined in src/components/date-picker/date-picker.ts:333
Returns number
selectionStart
Section titled "selectionStart"The offset of the start of the text selection in the input, in UTF-16
code units. Equals selectionEnd when no text is selected.
get selectionStart(): number Defined in src/components/date-picker/date-picker.ts:325
Returns number
validationMessage
Section titled "validationMessage"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The validation message of the control. It is empty when the control is valid.
get validationMessage(): string Defined in src/internals/mixins/forms/types.ts:61
Returns string
validity
Section titled "validity"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
The validity state of the control.
get validity(): ValidityState Defined in src/internals/mixins/forms/types.ts:55
Returns ValidityState
value
Section titled "value"get value(): any The value of the picker.
Only ever holds a committed value. While the user is typing in the input, the
intermediate state stays in the editor and is committed - together with an
igcChange event - when the edit is committed on blur. Use the igcInput event
to observe the value as it is being typed.
set value(value: string | Date | null | undefined): void Defined in src/components/date-picker/date-picker.ts:304
Parameters
- value:
string | Date | null | undefined
Returns void
visibleMonths
Section titled "visibleMonths"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get visibleMonths(): any Defined in src/components/date-picker/date-picker.base.ts:421
The number of months displayed in the calendar.
set visibleMonths(value: number): void Defined in src/components/date-picker/date-picker.base.ts:421
Parameters
- value:
number
Returns void
weekStart
Section titled "weekStart"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
get weekStart(): any Defined in src/components/date-picker/date-picker.base.ts:478
The first day of the week in the calendar.
set weekStart(value: WeekDays | undefined): void Defined in src/components/date-picker/date-picker.base.ts:478
Parameters
- value:
WeekDays | undefined
Returns void
willValidate
Section titled "willValidate"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Whether the control is a candidate for constraint validation.
get willValidate(): boolean Defined in src/internals/mixins/forms/types.ts:64
Returns boolean
Methods
Section titled "Methods"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Removes focus from the picker.
blur(): void Defined in src/components/date-picker/date-picker.base.ts:690
Returns void
checkValidity
Section titled "checkValidity"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Checks validity and emits invalid when the control is invalid. Returns
true when the control is valid.
checkValidity(): boolean Defined in src/internals/mixins/forms/types.ts:134
Returns boolean
clear
Section titled "clear"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Clears the value and the input text of the picker.
clear(): void Defined in src/components/date-picker/date-picker.base.ts:696
Returns void
focus
Section titled "focus"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Sets focus on the picker.
focus(options: FocusOptions): void Defined in src/components/date-picker/date-picker.base.ts:683
Parameters
- options:
FocusOptions
Returns void
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Closes the component. It does not emit events. The promise resolves to
false when the component is already closed, or when a later call
replaces this one.
hide(): Promise<boolean> Defined in src/internals/bases/combo-box.ts:135
Returns Promise<boolean>
reportValidity
Section titled "reportValidity"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Checks validity. As for a native control, an invalid control emits
invalid and takes the focus. It shows its own validation messages, not
the message of the browser. Returns true when the control is valid.
reportValidity(): boolean Defined in src/internals/mixins/forms/types.ts:141
Returns boolean
select
Section titled "select"Selects the text in the input of the component.
select(): void Defined in src/components/date-picker/date-picker.ts:386
Returns void
setCustomValidity
Section titled "setCustomValidity"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Sets a custom validation message. The control is invalid while the message is not empty. An empty string removes the custom error.
setCustomValidity(message: string): void Defined in src/internals/mixins/forms/types.ts:147
Parameters
- message:
string
Returns void
setRangeText
Section titled "setRangeText"Replaces the text from start to end in the input and re-applies the
mask. Without start and end, replaces the selected text.
setRangeText(replacement: string, start: number, end: number, mode: RangeTextSelectMode): void Defined in src/components/date-picker/date-picker.ts:405
Parameters
- replacement:
string - start:
number - end:
number - mode:
RangeTextSelectMode
Returns void
setSelectionRange
Section titled "setSelectionRange"Sets the text selection range in the input of the component.
setSelectionRange(start: number, end: number, direction: SelectionRangeDirection): void Defined in src/components/date-picker/date-picker.ts:392
Parameters
- start:
number - end:
number - direction:
SelectionRangeDirection
Returns void
Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Opens the component. It does not emit events. The promise resolves to
false when the component is already open, or when a later call replaces
this one.
show(): Promise<boolean> Defined in src/internals/bases/combo-box.ts:126
Returns Promise<boolean>
stepDown
Section titled "stepDown"Decrements a date part by delta, or by 1. Without datePart, it changes the
part at the cursor or a default part.
stepDown(datePart: DatePart, delta: number): void Defined in src/components/date-picker/date-picker.ts:380
Parameters
- datePart:
DatePart - delta:
number
Returns void
stepUp
Section titled "stepUp"Increments a date part by delta, or by 1. Without datePart, it changes the
part at the cursor or a default part.
stepUp(datePart: DatePart, delta: number): void Defined in src/components/date-picker/date-picker.ts:371
Parameters
- datePart:
DatePart - delta:
number
Returns void
toggle
Section titled "toggle"Inherited from: I18nMixin( EventEmitterMixin< IgcDatePickerComponentEventMap, typeof IgcDatePickerBaseComponent<Date> >(IgcDatePickerBaseComponent), i18n )
Opens the component when it is closed, and closes it when it is open. It
does not emit events. The promise resolves to true when the state
changes.
toggle(): Promise<boolean> Defined in src/internals/bases/combo-box.ts:144