For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /dolan/date-picker.md.

Date Picker

A form field that shows a day, and opens a calendar in a bottom sheet to pick another.

Installation

npx @blotch/dolan add date-picker
import { UiDatePicker } from '../components/ui/date-picker';
Tip

This also adds Calendar, Bottom Sheet, Button and Icon.

Usage

src/app/app.ts
import { Component, signal } from '@angular/core';
import { UiDatePicker } from '../components/ui/date-picker';

@Component({
  selector: 'app-root',
  imports: [UiDatePicker],
  template: `
    <ui-date-picker
      label="Ends on"
      placeholder="Pick a day"
      [(value)]="endsOn"
    />
  `,
})
export class App {
  protected readonly endsOn = signal<Date | null>(null);
}
  • Tapping the field opens a sheet with a Calendar, at the chosen day's month.
  • Tapping a day sets value, emits changed, and closes the sheet.
  • Tapping the backdrop, or dragging the sheet down, closes it without a change.
  • The field shows the day as Nov 20, 2026, or placeholder while there's none.

Let the user clear it

<ui-date-picker label="Ends on" clearable [(value)]="endsOn" />

While a day is chosen, the sheet has a Clear button under the calendar. It sets value to null, emits changed with null, and closes the sheet. Translate it with clearLabel.

Format the day

<ui-date-picker label="Delivery" format="EEEE d MMMM" [(value)]="delivery" />

format takes any Angular date format: a name such as 'longDate', or a pattern. The field writes it in the app's LOCALE_ID, as the calendar does (see Languages).

Limit the days

<ui-date-picker
  label="Birthday"
  format="longDate"
  [max]="today"
  [(value)]="birthday"
/>

min, max and weekStartsOn go to the calendar, as do its screen reader labels. To reach a day years away, tap the calendar's title.

With a label of your own

label is shown above the field and names it for screen readers. A label of your own, such as a Label, isn't tied to it, so give the picker an accessibility-label with the same text:

<view class="flex flex-col gap-2">
  <ui-label>Ends on</ui-label>
  <ui-date-picker accessibility-label="Ends on" [(value)]="endsOn" />
</view>

Disabled

<ui-date-picker label="Signed on" [value]="signedOn" disabled />

A disabled picker dims and doesn't open.

Open from code

UiDatePicker has public open(), close() and toggle() methods. Get it with viewChild(UiDatePicker) and call them from a handler. open() and toggle() do nothing while disabled.

API

InputTypeDefaultDescription
valueDate | nullnullThe chosen day. Supports [(value)].
labelstring''Shown above the field, and read by screen readers as its name.
placeholderstring'Select date'Shown in the field while no day is chosen.
accessibility-labelstring''The field's name for screen readers when it has no label.
formatstring'mediumDate'How the field writes the day: an Angular date format.
minDate | nullnullThe first day that can be picked.
maxDate | nullnullThe last day that can be picked.
weekStartsOn0 | 1 | 2 | 3 | 4 | 5 | 6The locale'sThe weekday in the calendar's first column. 0 is Sunday.
clearablebooleanfalseAdds a Clear button to the sheet while a day is chosen.
clearLabelstring'Clear'The Clear button's text.
previousMonthLabelstring'Previous month'The calendar's arrow back, among the days, for screen readers.
nextMonthLabelstring'Next month'The calendar's arrow on, among the days, for screen readers.
previousYearLabelstring'Previous year'The calendar's arrow back, among the months, for screen readers.
nextYearLabelstring'Next year'The calendar's arrow on, among the months, for screen readers.
disabledbooleanfalseDims the field and stops it from opening.
classstring''Extra Tailwind classes for the column that holds the label and the field.
OutputTypeDescription
changedDate | nullEmits the day the user tapped, or null when they cleared it.
valueChangeDate | nullEmits the new value, for [(value)].

Accessibility

  • The field is one button to VoiceOver and TalkBack, named by label (or accessibility-label), with the day it shows, or the placeholder, as its value: VoiceOver says "Ends on, Nov 20, 2026, button". Without either, its name is the text it shows.
  • A disabled field is dimmed to VoiceOver as well.
  • In the sheet, each day is a button named by its whole date (see Calendar).
  • The field is 48px tall. In the sheet, the calendar's controls and Clear are touch targets at least 48px each way, on phones 360px wide and up.
fireEvent.tap(screen.getByRole('button', { name: 'Ends on' }));
fireEvent.tap(
  await screen.findByRole('button', { name: 'Friday, November 20, 2026' }),
);
  • Calendar: the calendar on its own, in the page
  • Select: a field that opens a list of options
  • Bottom Sheet: the panel the calendar opens in