import {MatDatepickerModule} from '@angular/material/datepicker';
DefaultMatCalendarRangeStrategy
Provides the default date range selection behavior.
createPreview | |
---|---|
Parameters | |
activeDate D
|
|
currentRange DateRange<D>
|
|
selectionFinished | |
---|---|
Parameters | |
date D
|
|
currentRange DateRange<D>
|
|
MatDatepickerIntl
Datepicker data that requires internationalization.
Name | Description |
---|---|
|
A label for the calendar popup (used by screen readers). |
|
Stream that emits whenever the labels here are changed. Use this to notify components if the labels have changed after initialization. |
|
Label for the button used to close the calendar popup. |
|
A label for the next month button (used by screen readers). |
|
A label for the next multi-year button (used by screen readers). |
|
A label for the next year button (used by screen readers). |
|
A label for the button used to open the calendar popup (used by screen readers). |
|
A label for the previous month button (used by screen readers). |
|
A label for the previous multi-year button (used by screen readers). |
|
A label for the previous year button (used by screen readers). |
|
A label for the 'switch to month view' button (used by screen readers). |
|
A label for the 'switch to year view' button (used by screen readers). |
formatYearRange | |
---|---|
Formats a range of years. |
|
Parameters | |
start string
|
|
end string
|
|
Returns | |
string
|
|
MatDatepickerInput
Directive used to connect an input to a MatDatepicker.
Selector: input[matDatepicker]
Exported as: matDatepickerInputName | Description |
---|---|
@Input('matDatepickerFilter')
|
Function that can be used to filter out dates within the datepicker. |
@Input()
|
Whether the datepicker-input is disabled. |
@Input()
|
The datepicker that this input is associated with. |
@Input()
|
The maximum valid date. |
@Input()
|
The minimum valid date. |
@Input()
|
The value of the input. |
@Output()
|
Emits when a |
@Output()
|
Emits when an |
|
Emits when the internal state has changed |
getConnectedOverlayOrigin | |
---|---|
Gets the element that the datepicker popup should be connected to. |
|
Returns | |
ElementRef
|
The element to connect the popup to. |
getOverlayLabelId | |
---|---|
Gets the ID of an element that should be used a description for the calendar overlay. |
|
Returns | |
string | null
|
|
getStartValue | |
---|---|
Gets the value at which the calendar should start. |
|
Returns | |
D | null
|
|
getThemePalette | |
---|---|
Returns the palette used by the input's form field, if any. |
|
Returns | |
ThemePalette
|
|
MatDateRangePicker
Component responsible for managing the date range picker popup/dialog.
Selector: mat-date-range-picker
Exported as: matDateRangePickerName | Description |
---|---|
@Input()
|
An input indicating the type of the custom header component for the calendar, if set. |
@Input()
|
Color palette to use on the datepicker's calendar. |
@Input()
|
Function that can be used to add custom CSS classes to dates. |
@Input()
|
Whether the datepicker pop-up should be disabled. |
@Input()
|
Whether the calendar is open. |
@Input()
|
Classes to be passed to the date picker panel.
Supports string and string array values, similar to |
@Input()
|
Whether to restore focus to the previously-focused element when the calendar is closed. Note that automatic focus restoration is an accessibility feature and it is recommended that you provide your own equivalent, if you decide to turn it off. |
@Input()
|
The date to open the calendar to initially. |
@Input()
|
The view that the calendar should start in. |
@Input()
|
Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather than a dropdown and elements have more padding to allow for bigger touch targets. |
@Input()
|
Preferred position of the datepicker in the X axis. |
@Input()
|
Preferred position of the datepicker in the Y axis. |
@Output('closed')
|
Emits when the datepicker has been closed. |
@Output()
|
Emits selected month in year view. This doesn't imply a change on the selected date. |
@Output('opened')
|
Emits when the datepicker has been opened. |
@Output()
|
Emits when the current view changes. |
@Output()
|
Emits selected year in multiyear view. This doesn't imply a change on the selected date. |
|
The input element this datepicker is associated with. |
|
The id for the datepicker calendar. |
|
Emits when the datepicker's state changes. |
close | |
---|---|
Close the calendar. |
open | |
---|---|
Open the calendar. |
registerActions | |
---|---|
Registers a portal containing action buttons with the datepicker. |
|
Parameters | |
portal TemplatePortal<any>
|
|
registerInput | |
---|---|
Register an input with this datepicker. |
|
Parameters | |
input C
|
|
Returns | |
MatDateSelectionModel<S, D>
|
Selection model that the input should hook itself up to. |
removeActions | |
---|---|
Removes a portal containing action buttons from the datepicker. |
|
Parameters | |
portal TemplatePortal<any>
|
|
select | |
---|---|
Selects the given date |
|
Parameters | |
date D
|
|
MatStartDate
Input for entering the start date in a mat-date-range-input
.
Selector: input[matStartDate]
Name | Description |
---|---|
@Input()
|
Whether the datepicker-input is disabled. |
@Input()
|
An object used to control the error state of the component. |
@Input()
|
The value of the input. |
@Output()
|
Emits when a |
@Output()
|
Emits when an |
|
Whether the component is in an error state. |
|
Emits whenever the component state changes. |
focus | |
---|---|
Focuses the input. |
getMirrorValue | |
---|---|
Gets the value that should be used when mirroring the input's size. |
|
Returns | |
string
|
|
isEmpty | |
---|---|
Gets whether the input is empty. |
|
Returns | |
boolean
|
|
updateErrorState | |
---|---|
Updates the error state based on the provided error state matcher. |
MatEndDate
Input for entering the end date in a mat-date-range-input
.
Selector: input[matEndDate]
Name | Description |
---|---|
@Input()
|
Whether the datepicker-input is disabled. |
@Input()
|
An object used to control the error state of the component. |
@Input()
|
The value of the input. |
@Output()
|
Emits when a |
@Output()
|
Emits when an |
|
Whether the component is in an error state. |
|
Emits whenever the component state changes. |
focus | |
---|---|
Focuses the input. |
isEmpty | |
---|---|
Gets whether the input is empty. |
|
Returns | |
boolean
|
|
updateErrorState | |
---|---|
Updates the error state based on the provided error state matcher. |
MatCalendarHeader
Default header for MatCalendar
Selector: mat-calendar-header
Exported as: matCalendarHeaderName | Description |
---|---|
|
|
|
The label for the next button. |
|
|
|
The label for the current calendar view. |
|
The label for the previous button. |
currentPeriodClicked | |
---|---|
Handles user clicks on the period label. |
nextClicked | |
---|---|
Handles user clicks on the next button. |
nextEnabled | |
---|---|
Whether the next period button is enabled. |
|
Returns | |
boolean
|
|
previousClicked | |
---|---|
Handles user clicks on the previous button. |
previousEnabled | |
---|---|
Whether the previous period button is enabled. |
|
Returns | |
boolean
|
|
MatCalendar
A calendar that is used as part of the datepicker.
Selector: mat-calendar
Exported as: matCalendarName | Description |
---|---|
@Input()
|
End of the comparison range. |
@Input()
|
Start of the comparison range. |
@Input()
|
Function that can be used to add custom CSS classes to dates. |
@Input()
|
Function used to filter which dates are selectable. |
@Input()
|
An input indicating the type of the header component, if set. |
@Input()
|
The maximum selectable date. |
@Input()
|
The minimum selectable date. |
@Input()
|
The currently selected date. |
@Input()
|
A date representing the period (month or year) to start the calendar in. |
@Input()
|
Whether the calendar should be started in month or year view. |
@Output()
|
Emits the month chosen in year view. This doesn't imply a change on the selected date. |
@Output()
|
Emits when the currently selected date changes. |
@Output()
|
Emits when the current view changes. |
@Output()
|
Emits the year chosen in multiyear view. This doesn't imply a change on the selected date. |
|
The current active date. This determines which time period is shown and which date is highlighted when using keyboard navigation. |
|
Whether the calendar is in month view. |
|
Reference to the current month view component. |
|
Reference to the current multi-year view component. |
|
Emits whenever there is a state change that the header may need to respond to. |
|
Reference to the current year view component. |
focusActiveCell | |
---|---|
Focuses the active date. |
updateTodaysDate | |
---|---|
Updates today's date after an update of the active date |
MatDatepicker
Component responsible for managing the datepicker popup/dialog.
Selector: mat-datepicker
Exported as: matDatepickerName | Description |
---|---|
@Input()
|
An input indicating the type of the custom header component for the calendar, if set. |
@Input()
|
Color palette to use on the datepicker's calendar. |
@Input()
|
Function that can be used to add custom CSS classes to dates. |
@Input()
|
Whether the datepicker pop-up should be disabled. |
@Input()
|
Whether the calendar is open. |
@Input()
|
Classes to be passed to the date picker panel.
Supports string and string array values, similar to |
@Input()
|
Whether to restore focus to the previously-focused element when the calendar is closed. Note that automatic focus restoration is an accessibility feature and it is recommended that you provide your own equivalent, if you decide to turn it off. |
@Input()
|
The date to open the calendar to initially. |
@Input()
|
The view that the calendar should start in. |
@Input()
|
Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather than a dropdown and elements have more padding to allow for bigger touch targets. |
@Input()
|
Preferred position of the datepicker in the X axis. |
@Input()
|
Preferred position of the datepicker in the Y axis. |
@Output('closed')
|
Emits when the datepicker has been closed. |
@Output()
|
Emits selected month in year view. This doesn't imply a change on the selected date. |
@Output('opened')
|
Emits when the datepicker has been opened. |
@Output()
|
Emits when the current view changes. |
@Output()
|
Emits selected year in multiyear view. This doesn't imply a change on the selected date. |
|
The input element this datepicker is associated with. |
|
The id for the datepicker calendar. |
|
Emits when the datepicker's state changes. |
close | |
---|---|
Close the calendar. |
open | |
---|---|
Open the calendar. |
registerActions | |
---|---|
Registers a portal containing action buttons with the datepicker. |
|
Parameters | |
portal TemplatePortal<any>
|
|
registerInput | |
---|---|
Register an input with this datepicker. |
|
Parameters | |
input C
|
|
Returns | |
MatDateSelectionModel<S, D>
|
Selection model that the input should hook itself up to. |
removeActions | |
---|---|
Removes a portal containing action buttons from the datepicker. |
|
Parameters | |
portal TemplatePortal<any>
|
|
select | |
---|---|
Selects the given date |
|
Parameters | |
date D
|
|
MatDatepickerToggleIcon
Can be used to override the icon of a matDatepickerToggle
.
Selector: [matDatepickerToggleIcon]
MatDatepickerToggle
Selector: mat-datepicker-toggle
Exported as: matDatepickerToggleName | Description |
---|---|
@Input('aria-label')
|
Screenreader label for the button. |
@Input('for')
|
Datepicker instance that the button will toggle. |
@Input()
|
Whether ripples on the toggle should be disabled. |
@Input()
|
Whether the toggle button is disabled. |
MatDateRangeInput
Selector: mat-date-range-input
Exported as: matDateRangeInputName | Description |
---|---|
@Input()
|
End of the comparison range that should be shown in the calendar. |
@Input()
|
Start of the comparison range that should be shown in the calendar. |
@Input()
|
Function that can be used to filter out dates within the date range picker. |
@Input()
|
Whether the input is disabled. |
@Input()
|
The maximum valid date. |
@Input()
|
The minimum valid date. |
@Input()
|
The range picker that this input is associated with. |
@Input()
|
Whether the input is required. |
@Input()
|
Separator text to be shown between the inputs. |
|
Name of the form control. |
|
Whether the datepicker input is empty. |
|
Whether the input is in an error state. |
|
Whether the control is focused. |
|
Unique ID for the input. |
|
Whether the control's label should float. |
|
Emits when the input's state has changed. |
|
Current value of the range input. |
getConnectedOverlayOrigin | |
---|---|
Gets the element to which the calendar overlay should be attached. |
|
Returns | |
ElementRef
|
|
getOverlayLabelId | |
---|---|
Gets the ID of an element that should be used a description for the calendar overlay. |
|
Returns | |
string | null
|
|
getStartValue | |
---|---|
Gets the date at which the calendar should start. |
|
Returns | |
D | null
|
|
getThemePalette | |
---|---|
Gets the input's theme palette. |
|
Returns | |
ThemePalette
|
|
MatDatepickerApply
Button that will close the datepicker and assign the current selection to the data model.
Selector: [matDatepickerApply] [matDateRangePickerApply]
MatDatepickerCancel
Button that will close the datepicker and discard the current selection.
Selector: [matDatepickerCancel] [matDateRangePickerCancel]
MatDatepickerActions
Container that can be used to project a row of action buttons to the bottom of a datepicker or date range picker.
Selector: mat-datepicker-actions mat-date-range-picker-actions
MatDatepickerInputEvent
An event used for datepicker input and change events. We don't always have access to a native input or change event because the event may have been triggered by the user clicking on the calendar popup. For consistency, we always use MatDatepickerInputEvent instead.
Name | Description |
---|---|
|
Reference to the datepicker input component that emitted the event. |
|
Reference to the native input element associated with the datepicker input. |
|
The new value for the target datepicker input. |
DateRange
A class representing a range of dates.
Name | Description |
---|---|
|
The end date of the range. |
|
The start date of the range. |
MatDateRangeSelectionStrategy
Object that can be provided in order to customize the date range selection behavior.
createPreview | |
---|---|
Called when the user has activated a new date (e.g. by hovering over it or moving focus) and the calendar tries to display a date range. |
|
Parameters | |
activeDate D
|
|
currentRange DateRange<D>
|
|
event Event
|
|
Returns | |
DateRange<D>
|
|
selectionFinished | |
---|---|
Called when the user has finished selecting a value. |
|
Parameters | |
date D
|
|
currentRange DateRange<D>
|
|
event Event
|
|
Returns | |
DateRange<D>
|
|
MatCalendarUserEvent
Event emitted when a date inside the calendar is triggered as a result of a user action.
Name | Description |
---|---|
|
|
|
DatepickerDropdownPositionX
Possible positions for the datepicker dropdown along the X axis.
type DatepickerDropdownPositionX = 'start' | 'end';
DatepickerDropdownPositionY
Possible positions for the datepicker dropdown along the Y axis.
type DatepickerDropdownPositionY = 'above' | 'below';
DateFilterFn
Function that can be used to filter out dates from a calendar.
type DateFilterFn = (date: D | null) => boolean;
MatCalendarCellCssClasses
Extra CSS classes that can be associated with a calendar cell.
type MatCalendarCellCssClasses = string | string[] | Set<string> | {
[key: string]: any;
};
MatCalendarCellClassFunction
Function that can generate the extra classes that should be added to a calendar cell.
type MatCalendarCellClassFunction = (date: D, view: 'month' | 'year' | 'multi-year') => MatCalendarCellCssClasses;
MAT_DATE_RANGE_SELECTION_STRATEGY
Injection token used to customize the date range selection behavior.
const MAT_DATE_RANGE_SELECTION_STRATEGY: InjectionToken<MatDateRangeSelectionStrategy<any>>;
MAT_DATEPICKER_SCROLL_STRATEGY
Injection token that determines the scroll handling while the calendar is open.
const MAT_DATEPICKER_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
yearsPerPage
const yearsPerPage: 24;
yearsPerRow
const yearsPerRow: 4;