Date Picker
Un botón que muestra una fecha y abre un calendario en un popover, para una fecha o un rango, como control de formulario con formato de Intl.
Angular: disponible Vue: disponible React: disponible React Native: disponible
Uso
<div class="demo-row" style="align-items: flex-start; flex-wrap: wrap; min-height: 24rem">
<div soneField style="width: 15rem">
<label soneFieldLabel for="demo-due-date">Due date</label>
<sone-date-picker triggerId="demo-due-date" [(value)]="due" />
</div>
<div soneField style="width: 18rem">
<label soneFieldLabel for="demo-trip">Trip</label>
<sone-date-picker triggerId="demo-trip" mode="range" [(value)]="trip" [weekStartsOn]="1" placeholder="Pick the dates" />
</div>
</div>Importación
import {
SoneDatePickerComponent,
} from "@surface-one/angular/date-picker";Referencia de la API
SoneDatePickerComponentComponente
`<sone-date-picker>` — a field-like button that opens a calendar in a popover (shadcn/ui Date Picker): `[(value)]` is "YYYY-MM-DD" (or `{ start, end }` with `mode="range"`), shown through `Intl` in `locale`. The popover closes on a pick (a whole range) and gives focus back to the button; it is also a form control.
| Nombre | Tipo | Predeterminado |
|---|---|---|
modeOne date (`single`, the default) or a range (`range`). | SoneDatePickerMode | "single" |
valuebidireccionalThe picked date "YYYY-MM-DD" or `{ start, end }` (`range`) — `[(value)]`. | SoneCalendarValue | null |
openbidireccionalThe calendar is open — `[(open)]`. | boolean | false |
placeholderShown while no date is picked. | — | $localize`:Date picker placeholder:Pick a date` |
minThe earliest and latest date that can be picked ("YYYY-MM-DD"). | string | null | null |
max | string | null | null |
disabledDateRefuses more dates: `(iso) => true` disables that day. | ((iso: string) => boolean) | null | null |
weekStartsOnThe first day of the week: 0 = Sunday (the default) … 6 = Saturday. | SoneWeekday | 0 |
localeA BCP 47 tag for the shown date and the calendar (default: the app's `LOCALE_ID`). | string | null | null |
formatOptionsHow the date is shown (`Intl.DateTimeFormat` options); a long date by default. | Intl.DateTimeFormatOptions | { dateStyle: "long", } |
todayToday for the calendar, "YYYY-MM-DD" (default: the browser's, read after render). | string | null | null |
closeOnSelectClose the calendar once a date (or a whole range) is picked. | boolean | true |
disabled | boolean | false |
invalid | boolean | false |
triggerIdThe button's `id`, for a `<label for>`. | string | null | null |
ariaLabelNames the picker when no `<label>` does: read with the date, "Due date: May 4, 2026". | string | null | null |
ariaDescribedbyExtra ids for the button's `aria-describedby` (a hint, an error). | string | null | null |
dialogLabelNames the calendar popover. | — | $localize`:Date picker dialog:Choose a date` |
| Nombre | Tipo |
|---|---|
dateSelectFires on every pick, with the day picked. | string |