inputshwcz-calendar

Calendar

Accessible date grid with keyboard navigation, a month/year jumper, marked and disabled dates, and i18n/icon overrides.

Attributes

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''Initially selected date (YYYY-MM-DD); also sets the month shown on initialization.
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:host-inner · defaultstl target:host-inner

KeyDefault classclsstlDescription
button-markedz-nothingyesnoClass on the buttons of marked dates.
button-outside-monthz-nothingyesnoClass on the buttons of outside-month days.
button-selectedz-nothingyesnoClass on the selected day's button.
button-todayz-nothingyesnoClass on today's button.
day—yesyesDay cell wrapper; carries selected, today, marked, and outside-month state classes.
day-button—yesyesFocusable button inside each day cell.
day-markedz-cal-markedyesnoClass on cells whose date is listed in marked-dates.
day-outside-monthz-cal-oomyesnoClass on cells belonging to the previous or next month.
day-selectedz-activeyesnoClass on the selected day cell.
day-todayz-nothingyesnoClass on today's day cell.
grid—yesyesTable laying out the weekday header and week rows.
headerz-cal-headeryesyesMonth navigation bar above the grid.
host-innerz-calyesyesOuter calendar wrapper; the default cls and stl target.
jumperz-cal-jumperyesyesMonth and year stepper container shown when jumpable is set.
jumper-buttonz-button z-button-secondary z-button-icon z-button-smallyesyesStepper button shared by the month and year groups.
jumper-monthz-cal-jumper-monthyesyesMonth group: stepper buttons around the month select.
jumper-yearz-cal-jumper-yearyesyesYear group: stepper buttons around the year input.
month-selectz-select z-form-smallyesyesDropdown of month names.
next-buttonz-button z-button-secondary z-button-icon z-button-smallyesyesButton that steps to the next month.
previous-buttonz-button z-button-secondary z-button-icon z-button-smallyesyesButton that steps to the previous month.
titlez-cal-titleyesyesMonth and year label, or the jumper when jumpable is set.
week—yesyesRow of seven day cells.
weekday—yesyesSingle weekday header cell.
weekdays—yesyesHeader row of weekday names.
year-inputz-input z-form-smallyesyesFour-digit year input.

CSS Variables

VariableDefaultScopeDescription
--z-cal-cell-active-bgvar(--z-primary).z-cal table tbody tr td.z-active buttonBackground color of the selected day button.
--z-cal-cell-active-bg-o100%.z-cal table tbody tr td.z-active buttonOpacity applied to the selected day background.
--z-cal-cell-active-colorvar(--z-primary-f).z-cal table tbody tr td.z-active buttonText color of the selected day.
--z-cal-cell-active-color-o100%.z-cal table tbody tr td.z-active buttonOpacity applied to the selected day text color.
--z-cal-cell-body-font-size1rem.z-cal table tbody tr tdFont size of the day numbers.
--z-cal-cell-header-colorvar(--z-muted-f).z-cal table thead thText color of the weekday headers.
--z-cal-cell-header-color-o100%.z-cal table thead thOpacity applied to the weekday header text color.
--z-cal-cell-header-font-size0.875rem.z-cal table thead thFont size of the weekday headers.
--z-cal-cell-hover-bgvar(--z-accent).z-cal table tbody tr td button:hoverBackground color of day buttons on hover.
--z-cal-cell-hover-bg-ovar(--z-accent-o).z-cal table tbody tr td button:hoverOpacity applied to the hover background color.
--z-cal-cell-hover-colorvar(--z-accent-f).z-cal table tbody tr td button:hoverText color of day buttons on hover.
--z-cal-cell-hover-color-o100%.z-cal table tbody tr td button:hoverOpacity applied to the hover text color.
--z-cal-cell-oom-colorvar(--z-muted-f).z-cal table tbody tr td.z-cal-oom buttonText color of outside-month days.
--z-cal-cell-oom-color-o100%.z-cal table tbody tr td.z-cal-oom buttonOpacity applied to the outside-month day text color.
--z-cal-cell-padding0.z-cal table tbody tr tdPadding inside day cells.
--z-cal-cell-radiusvar(--z-global-radius).z-cal table tbody tr tdCorner radius of day cells.
--z-cal-cell-size2.5rem.z-calWidth and height of each day cell; also constrains the calendar's max width.
--z-cal-divider-cell-margin-bottom0.25rem.z-cal-divider table tbody tr tdBottom margin of cells in the divider variant.
--z-cal-divider-table-body-row-gap0.25rem.z-cal-divider table tbodyRow gap of the divider variant's body.
--z-cal-divider-table-row-border-colorvar(--z-border).z-cal-divider table tbody trRow border color in the divider variant.
--z-cal-divider-table-row-border-color-ovar(--z-border-o).z-cal-divider table tbody trOpacity applied to divider row borders.
--z-cal-divider-table-row-border-width1px.z-cal-divider table tbody trBottom border width of divider rows.
--z-cal-header-column-gap0.5rem.z-cal-headerGap between header items.
--z-cal-hover-duration150ms.z-cal table tbody tr td button:hoverDuration of the day-button hover transition.
--z-cal-jumper-column-gap0.5rem.z-cal-jumperGap between jumper groups.
--z-cal-jumper-input-width3rem.z-cal-jumperWidth token for the jumper's year input; declared in the jumper scope but not consumed by any current rule.
--z-cal-marked-bgvar(--z-info).z-cal-markedBackground tint of marked cells.
--z-cal-marked-bg-o4%.z-cal-markedOpacity applied to the marked-cell tint.
--z-cal-marked-border-colorvar(--z-info).z-cal-markedBorder color of marked cells.
--z-cal-marked-border-color-o32%.z-cal-markedOpacity applied to the marked-cell border color.
--z-cal-marked-dot-colorvar(--z-info).z-cal-markedColor of the marked-date indicator dot.
--z-cal-marked-dot-color-o100%.z-cal-markedOpacity applied to the indicator dot color.
--z-cal-marked-dot-offset0.75rem.z-cal-marked::afterPosition offset of the marked-date indicator dot.
--z-cal-marked-dot-size0.25rem.z-cal-markedWidth and height of the indicator dot.
--z-cal-table-body-row-gap0.5rem.z-cal table tbodyGap between week rows.
--z-cal-table-cell-gap0.125rem.z-cal table tbody tr, .z-cal table thead trGap between cells within a row.
--z-cal-table-row-gap0.5rem.z-cal tableGap between the table's header and body sections.
--z-cal-title-font-weight500.z-cal-titleFont weight of the month and year title.

i18n Keys

KeyDefaultPlaceholdersDescription
next-monthNext month—Accessible label of the next-month button in the header and jumper. Used in: jumper-button, next-button.
next-yearNext year—Accessible label of the jumper's next-year button. Used in: jumper-button.
prev-monthPrevious month—Accessible label of the previous-month button in the header and jumper. Used in: jumper-button, previous-button.
prev-yearPrevious year—Accessible label of the jumper's previous-year button. Used in: jumper-button.
select-monthSelect month—Accessible label of the month dropdown. Used in: month-select.
select-yearSelect year—Accessible label of the year input. Used in: year-input.

Icon Keys

KeyIconDescription
chevron-leftIcon on the previous-month and jumper stepper buttons.
chevron-rightIcon on the next-month and jumper stepper buttons.

Events

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

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-iso—descendantmarkerFull ISO timestamp bound to each day button; used for keyboard navigation and selection.
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-activestate.z-calState class on the selected day cell.
.z-calrootz-calendarRoot calendar class.
.z-cal-dividermodifier.z-calModifier that switches the grid to a divided, row-separated layout.
.z-cal-headerelement.z-calHeader bar layout (flex row).
.z-cal-header-lelement.z-calLeft header group that keeps its natural width.
.z-cal-header-relement.z-calRight header group that keeps its natural width.
.z-cal-jumperelement.z-calJumper layout container.
.z-cal-jumper-monthelement.z-calMonth group layout.
.z-cal-jumper-yearelement.z-calYear group layout.
.z-cal-markedstate.z-calState class on marked day cells; renders the indicator dot.
.z-cal-oomstate.z-calState class on outside-month day cells (muted).
.z-cal-titleelement.z-calMonth and year title styling.

Keyboard

KeysActionWhen
ArrowLeft ArrowRightMove focus to the previous / next enabled day.Focus is on a day button
ArrowUp ArrowDownMove focus to the same weekday in the previous / next week, skipping disabled days.Focus is on a day button
Home EndMove focus to the first / last enabled day of the week.Focus is on a day button
PageUp PageDownStep to the previous / next month.Focus is on a day button
Ctrl+PageUp Ctrl+PageDown Meta+PageUp Meta+PageDownStep to the previous / next year.Focus is on a day button
Enter Select the focused day.Focus is on a day button

Accessibility

PartARIADescription
dayaria-selected="dynamic" role="gridcell"Day cell (gridcell) whose aria-selected reflects selection.
day-buttonaria-disabled="dynamic" aria-label="dynamic" aria-pressed="dynamic"Day button with a full-date aria-label, aria-pressed for selection, and aria-disabled for unavailable dates.
header—Month navigation bar.
host-inneraria-label="Calendar" role="application"Calendar root with role="application" and a static aria-label.
jumper—Jumper container.
jumper-buttonaria-label="dynamic"Stepper button labelled by the prev/next month or year i18n text.
jumper-month—Month stepper group.
jumper-year—Year stepper group.
month-selectaria-label="dynamic"Month dropdown labelled by select-month.
next-buttonaria-label="dynamic"Next-month button labelled by next-month.
previous-buttonaria-label="dynamic"Previous-month button labelled by prev-month.
title—Month and year title container.
weekrole="row"Week row (role="row").
weekdayrole="columnheader"Weekday header cell (role="columnheader").
year-inputaria-label="dynamic"Year input labelled by select-year.
  • Roving tabindex: only the selected day (or today when nothing is selected) is tabbable; arrow keys move focus within the grid.
  • The grid combines role="application" on the root with grid, row, columnheader, and gridcell semantics.