Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
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.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/date-picker'; </script> <pm-date-picker label="Due date" hint="Type a date, or click the month title to jump by month and year."></pm-date-picker> <pm-date-picker label="Report period" range months="2" presets='[{"label":"Today","value":"today/today"},{"label":"Last 7 days","value":"-6d/today"},{"label":"Last 30 days","value":"-29d/today"},{"label":"This month","value":"month-start/month-end"},{"label":"Year to date","value":"year-start/today"}]'></pm-date-picker>

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.

Disabled
Read-only
Required
Error

Overview

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

AttributeTypeDefaultDescription
mobileboolean—Native mobile pattern on phones; not set means as the ancestors say, false opts out.
minstring—Lowest allowed value.
maxstring—Highest allowed value.
localestring—BCP 47 locale for formatting (default: the page language).
rangebooleanfalseSelect a start and end date instead of one date.
placeholderstring—Hint text shown while empty (not a replacement for label).
monthsnumber—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-footer
prop: hideFooter
booleanfalseHide the Today / Clear footer.
today-label
prop: todayLabel
string—Text of the footer's Today button (default "Today", or "Go to today" with range).
clear-label
prop: clearLabel
stringClearText of the footer's Clear button (default "Clear").
presets-label
prop: presetsLabel
stringQuick picksAccessible name of the list of presets (default "Quick picks").
openbooleanfalseThe popup is open. Setting it opens or closes it.
namestring—Form field name: the value is submitted under it.
valuestring—Current value (submitted with the form).
labelstring—Visible label (required for accessibility; use hide-label to visually hide it).
hintstring—Help text under the field, linked to it for screen readers.
errorstring—Custom error message. Setting it marks the control invalid.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'—Control size.
requiredbooleanfalseThe form cannot be submitted until this has a value.
disabledbooleanfalseNot interactive and not submitted.
readonlybooleanfalseFocusable and submitted, but not editable.
hide-label
prop: hideLabel
booleanfalseHide 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

EventReact / Svelte propDescription
pm-openonPmOpenThe popup opened.
pm-closeonPmCloseThe popup closed.
pm-changeonPmChangeWhen the value is committed.

Methods

show(), hide(), toggle(), close(), checkValidity(), reportValidity(), validate(), focus()

Used in templates

Orders