inputshwc
z-input-dateDate Input
Date picker combining a trigger button with the calendar dropdown, optional time selection, and formatted display values.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
display-format | string | 'MMMM DD, YYYY' | Display format for the trigger text (default MMMM DD, YYYY); the submitted value stays ISO. |
with-time | boolean | false | Adds time selection below the calendar. |
clock | '12h' | '24h' | '12h' | Time notation when with-time is set: 12h (default) or 24h. |
require-time | boolean | false | Requires a time before the value commits (with with-time). |
Inherited from BaseCalendarMixin
| Attribute | Type | Default | Description |
|---|---|---|---|
today | boolean | false | Selects today's date on initialization when no value is given. |
jumpable | boolean | false | Replaces the prev/next month buttons with a month select and a four-digit year input, each with its own stepper buttons. |
starts-with | number | 0 | First day of the week, from 0 (Sunday) to 6 (Saturday). |
disabled-dates | string | '' | Comma-separated ISO dates (YYYY-MM-DD) that cannot be selected. |
marked-dates | string | '' | Comma-separated ISO dates (YYYY-MM-DD) rendered with an indicator dot. |
view-date | string | new Date().toISOString().split('T')[0] | ISO date (YYYY-MM-DD) whose month is displayed; defaults to today in UTC. |
min | string | '' | Earliest selectable date (ISO, inclusive). |
max | string | '' | Latest selectable date (ISO, inclusive). |
weekday-format | 'long' | 'short' | 'narrow' | 'short' | Length of the weekday names in the header: long, short, or narrow. |
lang | string | 'en-us' | BCP-47 locale for month names, weekday names, and day labels. |
Inherited from InputMixin
| Attribute | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables the control so it cannot be interacted with. |
form | string | '' | Associates the hidden form input with a form by id, even when the component sits outside that form. |
name | string | '' | Field name for the hidden form input; array values submit as name[]. |
placeholder | string | '' | Placeholder text for the control's empty state. |
required | boolean | false | Marks the control as required. |
value | string | '' | Initial value of the control, synchronized with the hidden form input. |
Inherited from Hwc
| Attribute | Type | Default | Description |
|---|---|---|---|
i18n | string | '' | Per-instance text overrides as key: text pairs, merged over the global z-i18n script and the built-in defaults. |
floating | string | '' | Floating UI placement options (for example offset and shiftPadding) parsed as key: value pairs. |
force-prevent-rerender | boolean | false | Skips re-rendering after the first render; an existing data-host-inner child is adopted as the rendered DOM. |
template | string | '' | 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
| Attribute | Type | Default | Description |
|---|---|---|---|
cls | string | '' | Adds classes to named parts as key: classes pairs; a plain string targets the default part. |
stl | string | '' | 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
| Key | Default class | cls | stl | Description |
|---|---|---|---|---|
button | — | yes | no | The trigger button showing the formatted date. |
button-text | — | yes | yes | Text span inside the trigger. |
calendar | — | yes | yes | The calendar grid inside the dropdown. |
dropdown | z-dropdown z-datepicker-dropdown | yes | yes | The floating picker panel (default z-dropdown z-datepicker-dropdown). |
host-inner | — | yes | no | Rendered root wrapper. |
icon | — | yes | yes | Trigger icon slot (calendar icon). |
time | — | yes | yes | The time input inside the time section. |
time-wrapper | z-datepicker-time | yes | yes | Time selection section (default z-datepicker-time). |
CSS Variables
| Variable | Default | Scope | Description |
|---|---|---|---|
--z-datepicker-spacing | 1rem | .z-datepicker-dropdown | Spacing between the calendar and the time section. |
i18n Keys
| Key | Default | Placeholders | Description |
|---|---|---|---|
button-label | Select date | — | Accessible label of the trigger button. |
dialog-label | Date picker | — | Accessible label of the picker dropdown. Used in: dropdown. |
placeholder | Select a date | — | Trigger text when no date is selected. |
placeholder-with-time | Select a date and time | — | Trigger text when no date/time is selected and with-time is set. |
selected | selected | — | Suffix announced for the selected day. |
Icon Keys
| Key | Icon | Description |
|---|---|---|
calendar | Default trigger icon. |
Events
| Event | Detail | Flags | Description |
|---|---|---|---|
z-input-date:change · from InputMixin | { value: string | string[] } | bubbles | Fires when the committed date/time changes; detail.value carries the ISO value. |
Data Hooks
| Attribute | Values | Applies to | Role | Description |
|---|---|---|---|---|
data-host-inner · from Hwc | — | descendant | config | Marks the rendered inner wrapper so force-prevent-rerender can adopt server-rendered DOM without re-rendering. |
data-part | dropdown | descendant | marker | Marks the dropdown panel in adopted server-rendered DOM (data-part="dropdown"). |
data-reactive · from Hwc | — | descendant | config | Opts 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).
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | config | Marks the script as configuration (value: config). |
data-reactive | no | boolean | Re-parses the configuration when the script mutates. |
select[data-fn="data-source"]
Hidden select parsed into grouped option data by the base class.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | data-source | Marks the select as the data source (value: data-source). |
data-reactive | no | boolean | Re-parses the options when the select mutates. |
optgroup · repeatable
Groups options under a label.
| Attribute | Required | Type | Description |
|---|---|---|---|
label | yes | string | Group header text; also the default group key. |
disabled | no | boolean | Disables every option in the group. |
data-key | no | string | Overrides the group key used in the parsed data. |
data-keywords | no | comma-separated string | Comma-separated keywords stored with the group's data. |
option · repeatable
One option entry within the group.
| Attribute | Required | Type | Description |
|---|---|---|---|
value | no | string | Value carried by this option in the parsed data. |
disabled | no | boolean | Makes the option non-selectable. |
selected | no | boolean | Marks the option as initially selected. |
data-keywords | no | comma-separated string | Extra search terms, comma-separated; searched alongside the label and value. |
option · repeatable
One ungrouped option entry.
| Attribute | Required | Type | Description |
|---|---|---|---|
value | no | string | Value carried by this option in the parsed data. |
disabled | no | boolean | Makes the option non-selectable. |
selected | no | boolean | Marks the option as initially selected. |
data-keywords | no | comma-separated string | Extra search terms, comma-separated. |
template[data-fn="icons"]
Instance-level icon repository.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | icons | Marks the template as an icon source (value: icons). |
data-reactive | no | boolean | Re-parses the icons when the template mutates. |
* · repeatable
One icon element.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-key | yes | string | Icon key referenced by $icons. |
template[data-fn="template"]
Deferred content template mounted by the base class.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | template | Marks the template for deferred mounting (value: template). |
data-reactive | no | boolean | Re-parses the template when it mutates. |
CSS Classes
| Class | Role | Applies to | Description |
|---|---|---|---|
.z-datepicker-dropdown | element | .z-datepicker | The date picker dropdown panel. |
.z-datepicker-time | state | .z-datepicker | The time selection section under the calendar. |
Keyboard
| Keys | Action | When |
|---|---|---|
| Escape | Closes the picker dropdown. | — |
Accessibility
| Part | ARIA | Description |
|---|---|---|
button | aria-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). |
dropdown | aria-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.