Search documentation

Search the documentation and open a page.

A date picker component for selecting dates and date ranges.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/date-picker

Composition

<app-date-picker> ├── [appDatePickerLabel] (optional) ├── <app-date-picker-input> (input-style trigger) ├── [appDatePickerControl] (button-style trigger) │ └── [appDatePickerTrigger] | <app-date-picker-trigger> │ └── [appDatePickerValueText] └── <app-date-picker-content> ├── <app-date-picker-day-view> | <app-date-picker-dual-month-day-view> ├── <app-date-picker-month-view> └── <app-date-picker-year-view>

Examples

Default

Loading...

Input

Loading...

Range

Loading...

Date of Birth

Loading...

API Reference

<app-date-picker>

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to connect the date-picker parts.
idsPartial<DatePickerElementIds> | undefined—Overrides generated identifiers for individual parts.
valueDateValue[] | undefined—Selected dates when controlled. Supports Angular two-way binding.
defaultValueDateValue[] | undefined—Initially selected dates when uncontrolled.
focusedValueDateValue | undefined—Focused date when controlled. Supports Angular two-way binding.
defaultFocusedValueDateValue | undefined—Initially focused date.
view"day" | "month" | "year" | undefined—Current view when controlled. Supports Angular two-way binding.
defaultView"day" | "month" | "year" | undefined—Initial calendar view.
openboolean | undefined—Popup state when controlled. Supports Angular two-way binding.
defaultOpenbooleanfalseInitial popup state when uncontrolled.
inlinebooleanfalseRenders the calendar inline instead of in popup content.
disabledbooleanfalseDisables interaction with the date picker.
readOnlybooleanfalsePrevents changes while preserving focus and navigation.
requiredbooleanfalseMarks the associated form control as required.
invalidbooleanfalseMarks the associated form control as invalid.
outsideDaySelectablebooleanfalseAllows days outside the visible month to be selected.
closeOnSelectbooleantrueCloses the popup after a selection is completed.
openOnClickbooleanfalseOpens the popup when its input is clicked.
fixedWeeksbooleanfalseAlways renders six calendar weeks.
showWeekNumbersbooleanfalseIncludes week numbers in the calendar grid.
minDateValue | undefined—Earliest selectable date.
maxDateValue | undefined—Latest selectable date.
minView"day" | "month" | "year" | undefined—Most detailed view available.
maxView"day" | "month" | "year" | undefined—Broadest view available.
numOfMonthsnumber | undefined—Number of months represented by the calendar state.
startOfWeeknumber | undefined—First weekday, from 0 for Sunday through 6 for Saturday.
selectionMode"single" | "multiple" | "range" | undefined—Determines how dates are selected.
maxSelectedDatesnumber | undefined—Limits selections in multiple mode.
localestring | undefined—Locale used to format and parse dates.
timeZonestring | undefined—Time zone used when converting and formatting values.
translationsDatePickerIntlTranslations | undefined—Accessible labels for the date-picker controls.
namestring | undefined—Name used when submitting the value with a form.
placeholderstring | undefined—Placeholder used by the default formatter.
format((date: DateValue, details: DatePickerLocaleDetails) => string) | undefined—Formats values for inputs and value text.
parse((value: string, details: DatePickerLocaleDetails) => DateValue | undefined) | undefined—Parses typed input into a date value.
createCalendar((identifier: CalendarIdentifier) => Calendar) | undefined—Creates the calendar system used by the picker.
isDateUnavailable((date: DateValue, locale: string) => boolean) | undefined—Marks dates that cannot be selected.
positioningDatePickerPositioningOptions | undefined—Configures popup placement and collision handling.

Outputs

OutputTypeDescription
valueChangeDateValue[] | undefinedEmits the updated selected dates.
focusedValueChangeDateValue | undefinedEmits the updated focused date.
viewChange"day" | "month" | "year" | undefinedEmits the updated calendar view.
openChangeboolean | undefinedEmits the updated popup state.
valueDetailsChangeDatePickerValueChangeDetailsEmits detailed selection-change information.
focusChangeDatePickerFocusChangeDetailsEmits when the focused date changes.
viewDetailsChangeDatePickerViewChangeDetailsEmits detailed view-change information.
visibleRangeChangeDatePickerVisibleRangeChangeDetailsEmits when the visible date range changes.
openDetailsChangeDatePickerOpenChangeDetailsEmits detailed open-state change information.

<app-date-picker-input>

Inputs

InputTypeDefaultDescription
idstring | undefined—ID applied to the generated native input.
placeholderstring""Placeholder displayed by the input.
disabledbooleanfalseDisables the input and its generated controls.
showTriggerbooleantrueShows the generated calendar trigger.
showClearbooleanfalseShows a clear action when the input has a value.
size"default" | "lg" | "xl""default"Sets the input-group size.

Configurable Directives

SelectorInputTypeDescription
[appDatePickerView]view"day" | "month" | "year"Identifies the calendar view rendered inside it.
[appDatePickerTableCell]valueDateValue | numberDate, month, or year represented by the cell.
[appDatePickerTableCell]visibleRangeDatePickerVisibleRange | undefinedAssociates the cell with an offset month range.
[appDatePickerPresetTrigger]valueDatePickerPresetTriggerValueDate or range selected by the preset trigger.

Components, Directives, and Context

ExportAngular API
DatePickerLabelDirective[appDatePickerLabel] label directive.
DatePickerControlDirective[appDatePickerControl] groups a trigger or input with the picker.
DatePickerInputComponent<app-date-picker-input> input-group component.
DatePickerInputDirective[appDatePickerInput] applies date-input behavior to a native input.
DatePickerTriggerComponent<app-date-picker-trigger> generated trigger component.
DatePickerTriggerDirective[appDatePickerTrigger] applies trigger behavior to a custom button.
DatePickerClearTriggerComponent<app-date-picker-clear> generated clear button.
DatePickerContentComponent<app-date-picker-content> portalled popup content.
DatePickerDayViewComponent<app-date-picker-day-view> single-month day grid.
DatePickerDualMonthDayViewComponent<app-date-picker-dual-month-day-view> two-month day grid with shared navigation.
DatePickerMonthViewComponent<app-date-picker-month-view> month-selection grid.
DatePickerYearViewComponent<app-date-picker-year-view> year-selection grid.
DatePickerValueTextDirective[appDatePickerValueText] displays the selected value inside a custom trigger.
DatePickerRangeTextDirective[appDatePickerRangeText] displays the current view range.
DatePickerContextStructural directive [date-picker-context] exposing the picker API to a template.
DatePickerRootProviderProvides an externally created date-picker machine to a component tree.
DatePickerImportsReadonly collection containing all date-picker components and directives.
useDatePickerCreates a date-picker machine within an Angular injection context.
injectDatePickerContextInjects the nearest date-picker machine.

Utilities and Supporting Types

ExportAPI
CalendarDateRepresents a calendar date without a time or time zone.
DateValueDate value type accepted by the picker.
getLocalTimeZoneReturns the current local IANA time-zone identifier.
parseDateParses an ISO 8601 date string into a CalendarDate.