Forms Form-associated
DatePicker <pm-date-picker>
Date picker: a text field that accepts typed dates (ISO or the locale's format) plus a calendar popup.
Sizes
Set with the size attribute; controls keep touch-sized targets on phones.
size="xs"size="sm"size="md"size="lg"size="xl"States
Each state is one attribute.
DisabledRead-onlyRequiredErrorOverview
The popup has month and year views (click its title), side-by-side months, quick presets and Today / Clear. Value is always "YYYY-MM-DD" (or "start/end" with range), submitted with forms.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
mobile | boolean | — | Native mobile pattern on phones; not set means as the ancestors say, false opts out. |
min | string | — | Lowest allowed value. |
max | string | — | Highest allowed value. |
locale | string | — | BCP 47 locale for formatting (default: the page language). |
range | boolean | false | Select a start and end date instead of one date. |
placeholder | string | — | Hint text shown while empty (not a replacement for label). |
months | number | — | Months shown side by side in the popup (1–3). |
presets | { label: string; value: string }[] | — | Quick picks beside the calendar: [{ label, value }]. Values are ISO dates or relative tokens (today, -7d,
+1w, -3m, -1y, month-start, month-end, year-start, year-end), joined with "/" for ranges. |
hide-footerprop: hideFooter | boolean | false | Hide the Today / Clear footer. |
today-labelprop: todayLabel | string | — | Text of the footer's Today button (default "Today", or "Go to today" with range). |
clear-labelprop: clearLabel | string | Clear | Text of the footer's Clear button (default "Clear"). |
presets-labelprop: presetsLabel | string | Quick picks | Accessible name of the list of presets (default "Quick picks"). |
open | boolean | false | The popup is open. Setting it opens or closes it. |
name | string | — | Form field name: the value is submitted under it. |
value | string | — | Current value (submitted with the form). |
label | string | — | Visible label (required for accessibility; use hide-label to visually hide it). |
hint | string | — | Help text under the field, linked to it for screen readers. |
error | string | — | Custom error message. Setting it marks the control invalid. |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | — | Control size. |
required | boolean | false | The form cannot be submitted until this has a value. |
disabled | boolean | false | Not interactive and not submitted. |
readonly | boolean | false | Focusable and submitted, but not editable. |
hide-labelprop: hideLabel | boolean | false | Hide the label visually; it stays the accessible name. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-open | onPmOpen | The popup opened. |
pm-close | onPmClose | The popup closed. |
pm-change | onPmChange | When the value is committed. |
Methods
show(), hide(), toggle(), close(), checkValidity(), reportValidity(), validate(), focus()