Chapter 05 Choices
Date picker
A date to type or pick, or a range of dates for a stay. Type dates in the reader's own order, or open the calendar beside them or with Alt + Down. Unlike the browser's own picker, this calendar can close off days, such as a shop's day off. For ordinary dates and times, the native fields below use the browser's localized pickers. Date values stay plain ISO dates.
import { DatePickerComponent, TextFieldComponent } from '@okaapi-ui/angular';
// The value is an ISO date (YYYY-MM-DD), or null.
// For the browser's own date and time pickers, use TextFieldComponent.A delivery day
No deliveries on Fridays, and none in the past. Picking a day closes the calendar and returns to the button.
We deliver Saturday to Thursday.
<ui-date-picker
label="Delivery day"
min="2026-11-20"
hint="We deliver Saturday to Thursday."
[isDisabled]="isFriday"
formControlName="day"
/>
isFriday = (date: string) => new Date(date + 'T00:00:00Z').getUTCDay() === 5;A stay
Type the check-in and check-out dates, or choose them in the calendar. The range starts with its first date and ends when you pick the second.
<ui-date-picker
label="Stay"
selection="range"
rangeStartLabel="Check-in"
rangeEndLabel="Check-out"
[(range)]="stay"
/>A native date
Use the browser's own picker for a straightforward date. min and max keep it to dates that make sense.
Any day from January 2026.
<ui-text-field
label="Move-in date"
type="date"
min="2026-01-01"
hint="Any day from January 2026."
formControlName="moveIn"
/>A native time
The browser provides a localized time picker; step offers quarter-hour increments.
<!-- step in seconds: 900 offers quarter hours -->
<ui-text-field label="Delivery time" type="time" step="900" formControlName="time" />A native number
For a basic quantity, the browser's number input steps and checks its limits.
<ui-text-field label="Rooms" type="number" [min]="1" [max]="12" formControlName="rooms" />In Arabic
<ui-date-picker
label="يوم التوصيل"
locale="ar-EG"
calendarLabel="اختر التاريخ"
previousLabel="الشهر السابق"
nextLabel="الشهر التالي"
formControlName="day"
/>Native date in Arabic
<ui-text-field label="تاريخ الاستلام" type="date" formControlName="date" />When to use something else
| If you need | Use |
|---|---|
| Pick days by looking at a month, or a range | Calendar |
| A time only | Text field with type time |
Inputs
| Name | Type | Default | What it does |
|---|---|---|---|
label | string | — | Names the field and the calendar. |
min | max | string | — | Earliest and latest dates, as YYYY-MM-DD. |
isDisabled | (date: string) => boolean | — | Days that cannot be picked, such as closed days. |
hint | error | string | — | Help text, and the translated error that marks it invalid. |
calendarLabel | string | Choose date from labels | Names the calendar button. Translate it. |
selection | 'single' | 'range' | 'single' | Shows one date field, or two fields for a date range. |
range | DateRange | null | — | Two-way model for range mode. start is an ISO date; end is null until the second date is picked. |
rangeStartLabel | rangeEndLabel | string | 'Start date' | 'End date' from labels | Accessible names for the two fields in range mode. |
type (ui-text-field) | 'date' | 'time' | 'datetime-local' | 'number' | — | Use the browser native picker for dates and times, or a basic number input. |
min, max (ui-text-field) | string | number | — | The range: '2026-01-31' for a date, '09:00' for a time, 1 for a number. |
step (ui-text-field) | string | number | — | The steps: seconds for a time, units for a number. |
locale | string | LOCALE_ID | The calendar's month and day names. |
previousLabel | nextLabel | string | — | The calendar's month buttons. Translate them. |
Keyboard and screen readers
| Keys | What they do |
|---|---|
| Alt + Down | Open the calendar from the field. |
| Escape | Close the calendar, and put focus back on the field. |
- The fields take dates typed in the reader’s own order; the calendar keys are listed on the Calendar page.