Date picker
vig-date-picker
import { DatePicker } from '@vigdx/ui/date-picker';Basic
[(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
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.
Reactive Forms
VigValueAccessor next to the component to use formControlName , [formControl] or ngModel . Type the control as Date | null , or DateRange | null in range mode.
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"]
| Part | Element | data-state |
|---|---|---|
field | — | |
label | — | |
input | <input> . | — |
hint | vig-hint (a display: contents host; style its text part). | — |
disabled-reason | vig-hint with the disabled reason ( display: contents ). | — |
error | vig-field-error (a display: contents host; style its message part). | — |
clear | clearable ). | — |
trigger | — | |
panel | — | |
header | — | |
prev | — | |
view-switch | — | |
next | — | |
grid | role="grid" day grid. | — |
weekday | — | |
day | aria-selected , aria-current="date" ) with its date as data-date="YYYY-MM-DD" ; outside marks days of the neighbouring months. | outside |
months | — | |
month | aria-pressed ). | — |
years | — | |
year | aria-pressed ). | — |
time | showTime ). | — |
time-input | — | |
meridiem | hourFormat="12" ). | — |
| Attribute | Meaning |
|---|---|
data-date | [data-part="day"] ): its date, YYYY-MM-DD . |
Accessibility
- The text input has
role="combobox"witharia-haspopup="dialog"andaria-expanded; the calendar opens in a labelledrole="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-selectedand todayaria-current="date"; days outsideminDate/maxDateare 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 aplaceholderorhint. - The month header (also the grid's name) is worded and ordered by
Intl.DateTimeFormatfor 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-pickerDate 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
| Name | Type | Default | Description |
|---|---|---|---|
clearable | boolean | false | — |
clearAriaLabel | string | undefined | undefined | — |
dayNames | readonly string[] | undefined | undefined | — |
dayNamesMin | readonly string[] | undefined | undefined | — |
dialogAriaLabel | string | undefined | undefined | — |
dirty | boolean | false | — |
disabled | boolean | false | — |
disabledReasons | readonly WithOptionalFieldTree<DisabledReason>[] | [] | — |
errorMessages | Record<string, string> | — | — |
errors | readonly ValidationError.WithOptionalFieldTree[] | [] | — |
firstDayOfWeek | number | 1 | 0 = Sunday … 6 = Saturday. Defaults to Monday (ISO 8601). |
format | string | 'dd.MM.yyyy' | DatePipe-style tokens: dd, d, MM, M, yyyy, yy. PrimeNG's dd.mm.yy ⇒ dd.MM.yyyy. |
hidden | boolean | false | — |
hideLabel | boolean | false | 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. |
hint | string | undefined | undefined | — |
hourAriaLabel | string | undefined | undefined | — |
hourFormat | "12" | "24" | '24' | — |
invalid | boolean | false | — |
label | string | — | — |
labelPosition | LabelPosition | 'float' |
|
max | Date | undefined | undefined | Latest selectable day: a |
maxDate | Date | undefined | undefined | Latest selectable day; the same bound as |
meridiemLabels | readonly [string, string] | undefined | undefined | — |
min | Date | undefined | undefined | Earliest selectable day: a |
minDate | Date | undefined | undefined | Earliest selectable day; the same bound as |
minuteAriaLabel | string | undefined | undefined | — |
monthNames | readonly string[] | undefined | undefined | Month names, January first; the locale's labels by default. The calendar
header ("March 2026") is otherwise worded and ordered by
|
monthNamesShort | readonly string[] | undefined | undefined | — |
name | string | '' | — |
nextAriaLabel | string | undefined | undefined | — |
pending | boolean | false | — |
placeholder | string | undefined | undefined | — |
prevAriaLabel | string | undefined | undefined | — |
rangeSeparator | string | ' – ' | — |
readonly | boolean | false | — |
required | boolean | false | — |
secondAriaLabel | string | undefined | undefined | — |
selectionMode | DatePickerSelectionMode | 'single' | — |
showSeconds | boolean | false | — |
showTime | boolean | false | — |
size | FieldSize | 'md' | — |
toggleAriaLabel | string | undefined | undefined | — |
touched | boolean | false | — |
value | T | null | null | — |
| Name | Payload | Description |
|---|---|---|
touch | void | — |
valueChange | T | null | — |
| Signature | Description |
|---|---|
focus(options?: FocusOptions): void | Moves focus to the control's interactive element (the input, or the
trigger of a popup control). Signal Forms calls it through
|
reset(): void | Drops typed text and closes the calendar; see |
VigValueAccessor
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.
| Signature | Description |
|---|---|
registerOnChange(fn: (value: unknown) => void): void | — |
registerOnTouched(fn: () => void): void | — |
setDisabledState(disabled: boolean): void | — |
writeValue(value: unknown): void | — |