Date picker

A date field with a calendar panel, for single dates, date ranges and optionally a time of day. Users can type the date or pick it from the calendar.

  • vig-date-picker
Import
import { DatePicker } from '@vigdx/ui/date-picker';

Basic

Bind [(value)] to a Date | null signal. Click the field or the calendar button to open the panel, or type a date in the format (default dd.MM.yyyy ). clearable adds a button that resets the value to null .

Start: Sat Aug 15 2026 · Due: none

Range

selectionMode="range" makes the value a DateRange ( { start, end } ). The first click sets start , the second end ; end stays null in between. rangeSeparator sets the text between the two dates.

Start: Mon Aug 10 2026 · End: Thu Aug 20 2026

Minimum and maximum

minDate and maxDate disable the days outside the range in the calendar and keep keyboard navigation inside it. min and max are the same bounds under the names Signal Forms binds: with [formField] , minDate() and maxDate() schema rules reach the calendar on their own, and their errors show the bound in the field format. State the range in the hint too.

Between 10 and 20 August 2026.

Within August 2026.

Time

showTime adds hour and minute fields under the calendar, showSeconds a seconds field, and hourFormat="12" an AM/PM switch ( meridiemLabels ).

Locale and format

Month and day names and all button labels follow the locale set with provideVigdxUi or VigdxI18n.setLocale . format takes the tokens dd , d , MM , M , yyyy and yy , firstDayOfWeek is 0 (Sunday) to 6, and every text can also be set per instance.

Label, error, states and sizes

labelPosition="top" puts the label above the field and hideLabel hides it for toolbars. Errors show once the field is touched and invalid . readonly keeps the field focusable but does not open the calendar.

The contract starts on this day.

Please pick a date.

Reactive Forms

Import VigValueAccessor next to the component to use formControlName , [formControl] or ngModel . Type the control as Date | null , or DateRange | null in range mode.

{
  "birthday": null,
  "vacation": null
}

Signal Forms

vig-date-picker implements FormValueControl for Date | null (or DateRange | null ). A validate() rule can compare two dates of the model.

Valid: no

Storing dates

The value is a Date at local midnight of the chosen day. A Date is an instant, not a calendar day, so do not persist it with toISOString() or JSON.stringify: 15 March at midnight in Istanbul becomes 2026-03-14T21:00:00.000Z, and anyone reading it in another time zone can land on a different day. For birthdays, due dates and other calendar dates, store the ISO calendar date instead:

import { parseIsoDate, toIsoDate } from '@vigdx/ui';

save() {
  this.api.update({ dueDate: toIsoDate(this.dueDate()) }); // '2026-03-15'
}
load(saved: Task) {
  this.dueDate.set(parseIsoDate(saved.dueDate)); // local 15 March, any time zone
}

toIsoDate reads the local calendar day (null stays null); parseIsoDate returns local midnight of that day, or null for anything that is not a valid YYYY-MM-DD date. Avoid new Date('2026-03-15'): it parses as UTC midnight and shows the previous day west of Greenwich. With showTime the value is a real moment, so persist it as an instant (for example toISOString()) together with the time zone it was meant in.

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="date-picker"][data-part="field"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="date-picker"]

DatePicker styling hooks
Part Element data-state
field Positioned wrapper of the label and the control. —
label The visible (or floating) label. —
input The native <input> . —
hint The vig-hint (a display: contents host; style its text part). —
disabled-reason The vig-hint with the disabled reason ( display: contents ). —
error The vig-field-error (a display: contents host; style its message part). —
clear The clear button ( clearable ). —
trigger The calendar button. —
panel The calendar dialog, rendered in the overlay container. —
header Navigation row: previous, view switch, next. —
prev Previous month, year or decade. —
view-switch Month and year button that cycles the views. —
next Next month, year or decade. —
grid The role="grid" day grid. —
weekday A weekday column header. —
day A day cell ( aria-selected , aria-current="date" ) with its date as data-date="YYYY-MM-DD" ; outside marks days of the neighbouring months. outside
months The month view grid. —
month A month cell ( aria-pressed ). —
years The year view grid. —
year A year cell ( aria-pressed ). —
time The time row ( showTime ). —
time-input An hour, minute or second field. —
meridiem The AM/PM toggle ( hourFormat="12" ). —
DatePicker data attributes
Attribute Meaning
data-date On each day cell ( [data-part="day"] ): its date, YYYY-MM-DD .

Accessibility

  • The text input has role="combobox" with aria-haspopup="dialog" and aria-expanded; the calendar opens in a labelled role="dialog" (dialogAriaLabel).
  • The days form a role="grid": the arrows move by day and week (mirrored under right-to-left), Home and End go to the start and end of the week, Page Up and Page Down change the month (with Shift, the year), Enter or Space select, Escape closes.
  • The calendar renders at the end of the page, so leaving it with Tab past its last control continues from the field and Shift+Tab before its first control returns to the field; either way the calendar closes. When it closes while focus is inside (scrolling, a click on a blank area), focus goes back to the field instead of being lost.
  • Selected days set aria-selected and today aria-current="date"; days outside minDate / maxDate are disabled. Selected days, months and years keep the system selection colors in forced-colors mode, and the days inside a range are marked by a border, not by a tint alone.
  • The calendar, clear, previous and next buttons and the time fields have their own labels, all translatable through inputs or the locale.
  • Typing stays possible, so tell users the expected format, for example with a placeholder or hint.
  • The month header (also the grid's name) is worded and ordered by Intl.DateTimeFormat for the active locale, e.g. “2026年3月”. A language registered without calendar names gets its month and weekday names from Intl as well.

API

DatePicker

vig-date-picker component

Date field with a calendar panel. Each day cell of the calendar carries its date as data-date="YYYY-MM-DD"; days of the neighbouring months shown in the grid also carry data-state="outside". data-date

DatePicker props
Name Type Default Description
clearablebooleanfalse
—
clearAriaLabelstring | undefinedundefined
—
dayNamesreadonly string[] | undefinedundefined
—
dayNamesMinreadonly string[] | undefinedundefined
—
dialogAriaLabelstring | undefinedundefined
—
dirtybooleanfalse
—
disabledbooleanfalse
—
disabledReasonsreadonly WithOptionalFieldTree<DisabledReason>[][]
—
errorMessagesRecord<string, string>—
—
errorsreadonly ValidationError.WithOptionalFieldTree[][]
—
firstDayOfWeeknumber1

0 = Sunday … 6 = Saturday. Defaults to Monday (ISO 8601).

formatstring'dd.MM.yyyy'

DatePipe-style tokens: dd, d, MM, M, yyyy, yy. PrimeNG's dd.mm.yy ⇒ dd.MM.yyyy.

hiddenbooleanfalse
—
hideLabelbooleanfalse

Visually hides the label — it still names the control for assistive tech — and drops the row reserved for it, giving a shorter control for dense toolbars such as table filters. Pair it with a placeholder.

hintstring | undefinedundefined
—
hourAriaLabelstring | undefinedundefined
—
hourFormat"12" | "24"'24'
—
invalidbooleanfalse
—
label required string—
—
labelPositionLabelPosition'float'

float (default) rests the label inside the field; top sets it above a shorter field, for forms laid out with labels over their controls.

maxDate | undefinedundefined

Latest selectable day: a Date or an ISO yyyy-MM-dd string, bound from a maxDate() schema rule by [formField]. An alias of maxDate; when both are set, the earlier day wins.

maxDateDate | undefinedundefined

Latest selectable day; the same bound as max.

meridiemLabelsreadonly [string, string] | undefinedundefined
—
minDate | undefinedundefined

Earliest selectable day: a Date or an ISO yyyy-MM-dd string. Signal Forms binds it from a minDate() schema rule through [formField], so the calendar disables the days the validator rejects. An alias of minDate; when both are set, the later day wins.

minDateDate | undefinedundefined

Earliest selectable day; the same bound as min.

minuteAriaLabelstring | undefinedundefined
—
monthNamesreadonly string[] | undefinedundefined

Month names, January first; the locale's labels by default. The calendar header ("March 2026") is otherwise worded and ordered by Intl.DateTimeFormat; given names replace its month.

monthNamesShortreadonly string[] | undefinedundefined
—
namestring''
—
nextAriaLabelstring | undefinedundefined
—
pendingbooleanfalse
—
placeholderstring | undefinedundefined
—
prevAriaLabelstring | undefinedundefined
—
rangeSeparatorstring' – '
—
readonlybooleanfalse
—
requiredbooleanfalse
—
secondAriaLabelstring | undefinedundefined
—
selectionModeDatePickerSelectionMode'single'
—
showSecondsbooleanfalse
—
showTimebooleanfalse
—
sizeFieldSize'md'
—
toggleAriaLabelstring | undefinedundefined
—
touchedbooleanfalse
—
value model T | nullnull
—

VigValueAccessor

directive

Bridges the vigdx form fields to Reactive Forms (formControl, formControlName) and template-driven forms (ngModel). Import it next to the component; Signal Forms ([formField]) need no accessor.

VigValueAccessor methods
Signature Description
registerOnChange(fn: (value: unknown) => void): void
—
registerOnTouched(fn: () => void): void
—
setDisabledState(disabled: boolean): void
—
writeValue(value: unknown): void
—

Are you sure?