Skip to content
angulux
@anguless/angulux/datepicker

datepicker

1 declarations5 demos
import
import { DatePickerModule } from '@anguless/angulux/datepicker';

Basic

Two-way binding to a Date is all a plain date field needs.

<agl-datePicker [(ngModel)]="date" />

Icon and button bar

showIcon adds a trigger button; showButtonBar adds Today and Clear.

<agl-datePicker [(ngModel)]="date" [showIcon]="true" [showButtonBar]="true" />

Inline

An inline picker is always visible instead of opening in an overlay.

<agl-datePicker [(ngModel)]="date" [inline]="true" />

Range

In range mode the bound value is an array of two dates.

<agl-datePicker [(ngModel)]="dates" selectionMode="range" [readonlyInput]="true" />

Time

showTime adds a time section; hourFormat switches between 12 and 24 hours.

<agl-datePicker [(ngModel)]="date" [showTime]="true" hourFormat="24" />

API

Generated from the committed corpus, which check:corpus holds to the built library.

DatePicker

componentagl-datePicker, agl-datepicker, agl-date-picker

DatePicker is a form component to work with dates.

InputTypeDefaultDescription
iconDisplay'input' | 'button'not documented
styleClass
deprecated — since v20.0.0, use `class` instead.
string | undefinednot documentedStyle class of the component.
inputStyle{ [klass: string]: any } | null | undefinednot documentedInline style of the input field.
inputIdstring | undefinednot documentedIdentifier of the focus input to match a label defined for the component.
inputStyleClassstring | undefinednot documentedStyle class of the input field.
placeholderstring | undefinednot documentedPlaceholder text for the input.
ariaLabelledBystring | undefinednot documentedEstablishes relationships between the component and label(s) where its value should be one or more element IDs.
ariaLabelstring | undefinednot documentedDefines a string that labels the input for accessibility.
iconAriaLabelstring | undefinednot documentedDefines a string that labels the icon button for accessibility.
dateFormatstring | undefinednot documentedFormat of the date which can also be defined at locale settings.
multipleSeparatorstringnot documentedSeparator for multiple selection mode.
rangeSeparatorstringnot documentedSeparator for joining start and end dates on range selection mode.
inlinebooleannot documentedWhen enabled, displays the datepicker as inline. Default is false for popup mode.
showOtherMonthsbooleannot documentedWhether to display dates in other months (non-selectable) at the start or end of the current month. To make these days selectable use the selectOtherMonths option.
selectOtherMonthsboolean | undefinednot documentedWhether days in other months shown before or after the current month are selectable. This only applies if the showOtherMonths option is set to true.
showIconboolean | undefinednot documentedWhen enabled, displays a button with icon next to input.
iconstring | undefinednot documentedIcon of the datepicker button.
readonlyInputboolean | undefinednot documentedWhen specified, prevents entering the date manually with keyboard.
shortYearCutoffanynot documentedThe cutoff year for determining the century for a date.
hourFormatstringnot documentedSpecifies 12 or 24 hour format.
timeOnlyboolean | undefinednot documentedWhether to display timepicker only.
stepHournumbernot documentedHours to change per step.
stepMinutenumbernot documentedMinutes to change per step.
stepSecondnumbernot documentedSeconds to change per step.
showSecondsbooleannot documentedWhether to show the seconds in time picker.
showOnFocusbooleannot documentedWhen disabled, datepicker will not be visible with input focus.
showWeekbooleannot documentedWhen enabled, datepicker will show week numbers.
startWeekFromFirstDayOfYearbooleannot documentedWhen enabled, datepicker will start week numbers from first day of the year.
showClearbooleannot documentedWhen enabled, a clear icon is displayed to clear the value.
dataTypestringnot documentedType of the value to write back to ngModel, default is date and alternative is string.
selectionMode'single' | 'multiple' | 'range' | undefinednot documentedDefines the quantity of the selection, valid values are "single", "multiple" and "range".
maxDateCountnumber | undefinednot documentedMaximum number of selectable dates in multiple mode.
showButtonBarboolean | undefinednot documentedWhether to display today and clear buttons at the footer
todayButtonStyleClassstring | undefinednot documentedStyle class of the today button.
clearButtonStyleClassstring | undefinednot documentedStyle class of the clear button.
autofocusboolean | undefinednot documentedWhen present, it specifies that the component should automatically get focus on load.
autoZIndexbooleannot documentedWhether to automatically manage layering.
baseZIndexnumbernot documentedBase zIndex value to use in layering.
panelStyleClassstring | undefinednot documentedStyle class of the datetimepicker container element.
panelStyleanynot documentedInline style of the datetimepicker container element.
keepInvalidbooleannot documentedKeep invalid value when input blur.
hideOnDateTimeSelectbooleannot documentedWhether to hide the overlay on date selection.
touchUIboolean | undefinednot documentedWhen enabled, datepicker overlay is displayed as optimized for touch devices.
timeSeparatorstringnot documentedSeparator of time selector.
focusTrapbooleannot documentedWhen enabled, can only focus on elements inside the datepicker.
showTransitionOptions
deprecated — since v21.0.0, use `motionOptions` instead.
stringnot documentedTransition options of the show animation.
hideTransitionOptions
deprecated — since v21.0.0, use `motionOptions` instead.
stringnot documentedTransition options of the hide animation.
tabindexnumber | undefinednot documentedIndex of the element in tabbing order.
minDateDate | undefined | nullnot documentedThe minimum selectable date.
maxDateDate | undefined | nullnot documentedThe maximum selectable date.
disabledDatesDate[]not documentedArray with dates that should be disabled (not selectable).
disabledDaysnumber[]not documentedArray with weekday numbers that should be disabled (not selectable).
showTimebooleannot documentedWhether to display timepicker.
responsiveOptionsDatePickerResponsiveOptions[]not documentedAn array of options for responsive design.
numberOfMonthsnumbernot documentedNumber of months to display.
firstDayOfWeeknumbernot documentedDefines the first of the week for various date calculations.
viewDatePickerTypeViewnot documentedType of view to display, valid values are "date" for datepicker and "month" for month picker.
defaultDateDate | nullnot documentedSet the date to highlight on first opening if the field is blank.
appendToHTMLElement | ElementRef | TemplateRef<any> | 'self' | 'body' | null | undefined | any 'self' Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
motionOptionsMotionOptions | undefinednot documentedThe motion options.
OutputTypeDescription
onFocusEventEmitter<Event>Callback to invoke on focus of input field.
onBlurEventEmitter<Event>Callback to invoke on blur of input field.
onCloseEventEmitter<HTMLElement>Callback to invoke when date panel closed.
onSelectEventEmitter<Date>Callback to invoke on date select.
onClearEventEmitter<any>Callback to invoke when input field cleared.
onInputEventEmitter<any>Callback to invoke when input field is being typed.
onTodayClickEventEmitter<Date>Callback to invoke when today button is clicked.
onClearClickEventEmitter<any>Callback to invoke when clear button is clicked.
onMonthChangeEventEmitter<DatePickerMonthChangeEvent>Callback to invoke when a month is changed using the navigators.
onYearChangeEventEmitter<DatePickerYearChangeEvent>Callback to invoke when a year is changed using the navigators.
onClickOutsideEventEmitter<any>Callback to invoke when clicked outside of the date panel.
onShowEventEmitter<HTMLElement>Callback to invoke when datepicker panel is shown.
Template slotDescription
<ng-template #date>Custom template for date cells.
<ng-template #header>Custom template for header section.
<ng-template #footer>Custom template for footer section.
<ng-template #disabledDate>Custom template for disabled date cells.
<ng-template #decade>Custom template for decade view.
<ng-template #previousicon>Custom template for previous month icon.
<ng-template #nexticon>Custom template for next month icon.
<ng-template #triggericon>Custom template for trigger icon.
<ng-template #clearicon>Custom template for clear icon.
<ng-template #decrementicon>Custom template for decrement icon.
<ng-template #incrementicon>Custom template for increment icon.
<ng-template #inputicon>Custom template for input icon.
<ng-template #buttonbar>Custom template for button bar.

Inherited from BaseInput

inherited
InputTypeDefaultDescription
fluid false Spans 100% width of the container when enabled.
variant'filled' | 'outlined' | undefined 'outlined' Specifies the input variant of the component.
size'large' | 'small' | undefined undefined Specifies the size of the component.
inputSizenumber | null | undefined undefined Specifies the visible width of the input element in characters.
patternstring | null | undefined undefined Specifies the value must match the pattern. A list of regular expressions — what Signal Forms binds through `[formField]` — is ignored, because the form validates those itself.
minnumber | null | undefined undefined The value must be greater than or equal to the value. A numeric string is read as a number; anything else that is not a finite number, such as the `Date` limit of a date field, is ignored.
maxnumber | null | undefined undefined The value must be less than or equal to the value. A numeric string is read as a number; anything else that is not a finite number, such as the `Date` limit of a date field, is ignored.
stepnumber | null | undefined undefined Unless the step is set to the any literal, the value must be min + an integral multiple of the step.
minlengthnumber | null | undefined undefined The number of characters (code points) must not be less than the value of the attribute, if non-empty.
maxlengthnumber | null | undefined undefined The number of characters (code points) must not exceed the value of the attribute.

Inherited from BaseEditableHolder

inherited
InputTypeDefaultDescription
required false There must be a value (if set). Left unbound, a control bound through `formControlName`, `[formControl]` or `ngModel` is required when that control carries `Validators.required` or `Validators.requiredTrue`.
invalid false When present, it specifies that the component should have invalid state style. Left unbound, a control bound through `formControlName`, `[formControl]` or `ngModel` shows the state of that control once it is touched or dirty.
touchedboolean | undefined undefined Whether the user has visited the control. Once this or `dirty` is set, the invalid state style waits for interaction: it appears when the control is touched or dirty. Signal Forms' `[formField]` sets both, so an untouched required field is not shown as invalid. Leave both unset and `invalid` alone decides.
dirtyboolean | undefined undefined Whether the user has changed the value. See `touched`.
disabled false When present, it specifies that the component should have disabled state style.
namestring | undefined undefined When present, it specifies that the name of the input.

Inherited from BaseComponent

inherited
InputTypeDefaultDescription
dtObject | undefined undefined Defines scoped design tokens of the component.
unstyledboolean | undefined undefined Indicates whether the component should be rendered without styles.
ptPT | undefined undefined Used to pass attributes to DOM elements inside the component. TRUSTED INPUT ONLY. Whatever you put here is applied to the DOM as given: keys become attributes, and a key that names a DOM property is assigned to that property directly, with no sanitizer in between. That is what makes the API useful, and it means a value reaching it from a user, a database or a CMS can execute script. Treat it like markup you wrote yourself, not like data you received.
ptOptionsPassThroughOptions | undefined undefined Used to configure passthrough(pt) options of the component.