inputshwcz-input-date

Date Input

Date picker combining a trigger button with the calendar dropdown, optional time selection, and formatted display values.

Attributes

AttributeTypeDefaultDescription
display-formatstring'MMMM DD, YYYY'Display format for the trigger text (default MMMM DD, YYYY); the submitted value stays ISO.
with-timebooleanfalseAdds time selection below the calendar.
clock'12h' | '24h''12h'Time notation when with-time is set: 12h (default) or 24h.
require-timebooleanfalseRequires a time before the value commits (with with-time).
Inherited from BaseCalendarMixin
AttributeTypeDefaultDescription
todaybooleanfalseSelects today's date on initialization when no value is given.
jumpablebooleanfalseReplaces the prev/next month buttons with a month select and a four-digit year input, each with its own stepper buttons.
starts-withnumber0First day of the week, from 0 (Sunday) to 6 (Saturday).
disabled-datesstring''Comma-separated ISO dates (YYYY-MM-DD) that cannot be selected.
marked-datesstring''Comma-separated ISO dates (YYYY-MM-DD) rendered with an indicator dot.
view-datestringnew Date().toISOString().split('T')[0]ISO date (YYYY-MM-DD) whose month is displayed; defaults to today in UTC.
minstring''Earliest selectable date (ISO, inclusive).
maxstring''Latest selectable date (ISO, inclusive).
weekday-format'long' | 'short' | 'narrow''short'Length of the weekday names in the header: long, short, or narrow.
langstring'en-us'BCP-47 locale for month names, weekday names, and day labels.
Inherited from InputMixin
AttributeTypeDefaultDescription
disabledbooleanfalseDisables the control so it cannot be interacted with.
formstring''Associates the hidden form input with a form by id, even when the component sits outside that form.
namestring''Field name for the hidden form input; array values submit as name[].
placeholderstring''Placeholder text for the control's empty state.
requiredbooleanfalseMarks the control as required.
valuestring''Initial value of the control, synchronized with the hidden form input.
Inherited from Hwc
AttributeTypeDefaultDescription
i18nstring''Per-instance text overrides as key: text pairs, merged over the global z-i18n script and the built-in defaults.
floatingstring''Floating UI placement options (for example offset and shiftPadding) parsed as key: value pairs.
force-prevent-rerenderbooleanfalseSkips re-rendering after the first render; an existing data-host-inner child is adopted as the rendered DOM.
templatestring''Selector or id of an external element or <template> whose inner content is cloned in place of an inline template[data-fn="template"] child.
Inherited from Base
AttributeTypeDefaultDescription
clsstring''Adds classes to named parts as key: classes pairs; a plain string targets the default part.
stlstring''Adds inline styles to named parts as key: styles pairs; a plain string targets the default part.

Custom Styling (cls / stl)

Default cls target:button · defaultstl target:button

KeyDefault classclsstlDescription
button—yesnoThe trigger button showing the formatted date.
button-text—yesyesText span inside the trigger.
calendar—yesyesThe calendar grid inside the dropdown.
dropdownz-dropdown z-datepicker-dropdownyesyesThe floating picker panel (default z-dropdown z-datepicker-dropdown).
host-inner—yesnoRendered root wrapper.
icon—yesyesTrigger icon slot (calendar icon).
time—yesyesThe time input inside the time section.
time-wrapperz-datepicker-timeyesyesTime selection section (default z-datepicker-time).

CSS Variables

VariableDefaultScopeDescription
--z-datepicker-spacing1rem.z-datepicker-dropdownSpacing between the calendar and the time section.

i18n Keys

KeyDefaultPlaceholdersDescription
button-labelSelect date—Accessible label of the trigger button.
dialog-labelDate picker—Accessible label of the picker dropdown. Used in: dropdown.
placeholderSelect a date—Trigger text when no date is selected.
placeholder-with-timeSelect a date and time—Trigger text when no date/time is selected and with-time is set.
selectedselected—Suffix announced for the selected day.

Icon Keys

KeyIconDescription
calendarDefault trigger icon.

Events

EventDetailFlagsDescription
z-input-date:change · from InputMixin{ value: string | string[] }bubblesFires when the committed date/time changes; detail.value carries the ISO value.

Data Hooks

AttributeValuesApplies toRoleDescription
data-host-inner · from Hwc—descendantconfigMarks the rendered inner wrapper so force-prevent-rerender can adopt server-rendered DOM without re-rendering.
data-partdropdowndescendantmarkerMarks the dropdown panel in adopted server-rendered DOM (data-part="dropdown").
data-reactive · from Hwc—descendantconfigOpts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates.

Child Content

script[data-fn="config"][type="application/json"]

JSON configuration script parsed by the base class (i18n, cls, stl, floating).

AttributeRequiredTypeDescription
data-fnyesconfigMarks the script as configuration (value: config).
data-reactivenobooleanRe-parses the configuration when the script mutates.

select[data-fn="data-source"]

Hidden select parsed into grouped option data by the base class.

AttributeRequiredTypeDescription
data-fnyesdata-sourceMarks the select as the data source (value: data-source).
data-reactivenobooleanRe-parses the options when the select mutates.

optgroup · repeatable

Groups options under a label.

AttributeRequiredTypeDescription
labelyesstringGroup header text; also the default group key.
disablednobooleanDisables every option in the group.
data-keynostringOverrides the group key used in the parsed data.
data-keywordsnocomma-separated stringComma-separated keywords stored with the group's data.

option · repeatable

One option entry within the group.

AttributeRequiredTypeDescription
valuenostringValue carried by this option in the parsed data.
disablednobooleanMakes the option non-selectable.
selectednobooleanMarks the option as initially selected.
data-keywordsnocomma-separated stringExtra search terms, comma-separated; searched alongside the label and value.

option · repeatable

One ungrouped option entry.

AttributeRequiredTypeDescription
valuenostringValue carried by this option in the parsed data.
disablednobooleanMakes the option non-selectable.
selectednobooleanMarks the option as initially selected.
data-keywordsnocomma-separated stringExtra search terms, comma-separated.

template[data-fn="icons"]

Instance-level icon repository.

AttributeRequiredTypeDescription
data-fnyesiconsMarks the template as an icon source (value: icons).
data-reactivenobooleanRe-parses the icons when the template mutates.

* · repeatable

One icon element.

AttributeRequiredTypeDescription
data-keyyesstringIcon key referenced by $icons.

template[data-fn="template"]

Deferred content template mounted by the base class.

AttributeRequiredTypeDescription
data-fnyestemplateMarks the template for deferred mounting (value: template).
data-reactivenobooleanRe-parses the template when it mutates.

CSS Classes

ClassRoleApplies toDescription
.z-datepicker-dropdownelement.z-datepickerThe date picker dropdown panel.
.z-datepicker-timestate.z-datepickerThe time selection section under the calendar.

Keyboard

KeysActionWhen
EscapeCloses the picker dropdown.—

Accessibility

PartARIADescription
buttonaria-expanded="${this.$open}" aria-haspopup="dialog" aria-label="${this.buttonLabel}"Trigger: aria-haspopup="dialog", aria-expanded, labeled by button-label.
button-text—Formatted date text; no ARIA attributes.
calendar—Calendar grid (inherits the calendar accessibility model).
dropdownaria-label="${ariaLabel}" role="dialog"Picker panel: role="dialog" labeled by dialog-label.
host-inner—Root wrapper; no ARIA attributes.
icon—Trigger icon; no ARIA attributes.
time—Time input; no static ARIA attributes.
time-wrapper—Time section; no ARIA attributes.
  • The calendar inside the dropdown keeps the full calendar keyboard model (arrows, PageUp/PageDown, Home/End).
  • The submitted value is ISO (YYYY-MM-DD, with time when enabled); only the display is formatted.