inputshwc
z-calendarCalendar
Accessible date grid with keyboard navigation, a month/year jumper, marked and disabled dates, and i18n/icon overrides.
Attributes
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 | '' | Initially selected date (YYYY-MM-DD); also sets the month shown on initialization. |
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:host-inner · defaultstl target:host-inner
| Key | Default class | cls | stl | Description |
|---|---|---|---|---|
button-marked | z-nothing | yes | no | Class on the buttons of marked dates. |
button-outside-month | z-nothing | yes | no | Class on the buttons of outside-month days. |
button-selected | z-nothing | yes | no | Class on the selected day's button. |
button-today | z-nothing | yes | no | Class on today's button. |
day | — | yes | yes | Day cell wrapper; carries selected, today, marked, and outside-month state classes. |
day-button | — | yes | yes | Focusable button inside each day cell. |
day-marked | z-cal-marked | yes | no | Class on cells whose date is listed in marked-dates. |
day-outside-month | z-cal-oom | yes | no | Class on cells belonging to the previous or next month. |
day-selected | z-active | yes | no | Class on the selected day cell. |
day-today | z-nothing | yes | no | Class on today's day cell. |
grid | — | yes | yes | Table laying out the weekday header and week rows. |
header | z-cal-header | yes | yes | Month navigation bar above the grid. |
host-inner | z-cal | yes | yes | Outer calendar wrapper; the default cls and stl target. |
jumper | z-cal-jumper | yes | yes | Month and year stepper container shown when jumpable is set. |
jumper-button | z-button z-button-secondary z-button-icon z-button-small | yes | yes | Stepper button shared by the month and year groups. |
jumper-month | z-cal-jumper-month | yes | yes | Month group: stepper buttons around the month select. |
jumper-year | z-cal-jumper-year | yes | yes | Year group: stepper buttons around the year input. |
month-select | z-select z-form-small | yes | yes | Dropdown of month names. |
next-button | z-button z-button-secondary z-button-icon z-button-small | yes | yes | Button that steps to the next month. |
previous-button | z-button z-button-secondary z-button-icon z-button-small | yes | yes | Button that steps to the previous month. |
title | z-cal-title | yes | yes | Month and year label, or the jumper when jumpable is set. |
week | — | yes | yes | Row of seven day cells. |
weekday | — | yes | yes | Single weekday header cell. |
weekdays | — | yes | yes | Header row of weekday names. |
year-input | z-input z-form-small | yes | yes | Four-digit year input. |
CSS Variables
| Variable | Default | Scope | Description |
|---|---|---|---|
--z-cal-cell-active-bg | var(--z-primary) | .z-cal table tbody tr td.z-active button | Background color of the selected day button. |
--z-cal-cell-active-bg-o | 100% | .z-cal table tbody tr td.z-active button | Opacity applied to the selected day background. |
--z-cal-cell-active-color | var(--z-primary-f) | .z-cal table tbody tr td.z-active button | Text color of the selected day. |
--z-cal-cell-active-color-o | 100% | .z-cal table tbody tr td.z-active button | Opacity applied to the selected day text color. |
--z-cal-cell-body-font-size | 1rem | .z-cal table tbody tr td | Font size of the day numbers. |
--z-cal-cell-header-color | var(--z-muted-f) | .z-cal table thead th | Text color of the weekday headers. |
--z-cal-cell-header-color-o | 100% | .z-cal table thead th | Opacity applied to the weekday header text color. |
--z-cal-cell-header-font-size | 0.875rem | .z-cal table thead th | Font size of the weekday headers. |
--z-cal-cell-hover-bg | var(--z-accent) | .z-cal table tbody tr td button:hover | Background color of day buttons on hover. |
--z-cal-cell-hover-bg-o | var(--z-accent-o) | .z-cal table tbody tr td button:hover | Opacity applied to the hover background color. |
--z-cal-cell-hover-color | var(--z-accent-f) | .z-cal table tbody tr td button:hover | Text color of day buttons on hover. |
--z-cal-cell-hover-color-o | 100% | .z-cal table tbody tr td button:hover | Opacity applied to the hover text color. |
--z-cal-cell-oom-color | var(--z-muted-f) | .z-cal table tbody tr td.z-cal-oom button | Text color of outside-month days. |
--z-cal-cell-oom-color-o | 100% | .z-cal table tbody tr td.z-cal-oom button | Opacity applied to the outside-month day text color. |
--z-cal-cell-padding | 0 | .z-cal table tbody tr td | Padding inside day cells. |
--z-cal-cell-radius | var(--z-global-radius) | .z-cal table tbody tr td | Corner radius of day cells. |
--z-cal-cell-size | 2.5rem | .z-cal | Width and height of each day cell; also constrains the calendar's max width. |
--z-cal-divider-cell-margin-bottom | 0.25rem | .z-cal-divider table tbody tr td | Bottom margin of cells in the divider variant. |
--z-cal-divider-table-body-row-gap | 0.25rem | .z-cal-divider table tbody | Row gap of the divider variant's body. |
--z-cal-divider-table-row-border-color | var(--z-border) | .z-cal-divider table tbody tr | Row border color in the divider variant. |
--z-cal-divider-table-row-border-color-o | var(--z-border-o) | .z-cal-divider table tbody tr | Opacity applied to divider row borders. |
--z-cal-divider-table-row-border-width | 1px | .z-cal-divider table tbody tr | Bottom border width of divider rows. |
--z-cal-header-column-gap | 0.5rem | .z-cal-header | Gap between header items. |
--z-cal-hover-duration | 150ms | .z-cal table tbody tr td button:hover | Duration of the day-button hover transition. |
--z-cal-jumper-column-gap | 0.5rem | .z-cal-jumper | Gap between jumper groups. |
--z-cal-jumper-input-width | 3rem | .z-cal-jumper | Width token for the jumper's year input; declared in the jumper scope but not consumed by any current rule. |
--z-cal-marked-bg | var(--z-info) | .z-cal-marked | Background tint of marked cells. |
--z-cal-marked-bg-o | 4% | .z-cal-marked | Opacity applied to the marked-cell tint. |
--z-cal-marked-border-color | var(--z-info) | .z-cal-marked | Border color of marked cells. |
--z-cal-marked-border-color-o | 32% | .z-cal-marked | Opacity applied to the marked-cell border color. |
--z-cal-marked-dot-color | var(--z-info) | .z-cal-marked | Color of the marked-date indicator dot. |
--z-cal-marked-dot-color-o | 100% | .z-cal-marked | Opacity applied to the indicator dot color. |
--z-cal-marked-dot-offset | 0.75rem | .z-cal-marked::after | Position offset of the marked-date indicator dot. |
--z-cal-marked-dot-size | 0.25rem | .z-cal-marked | Width and height of the indicator dot. |
--z-cal-table-body-row-gap | 0.5rem | .z-cal table tbody | Gap between week rows. |
--z-cal-table-cell-gap | 0.125rem | .z-cal table tbody tr, .z-cal table thead tr | Gap between cells within a row. |
--z-cal-table-row-gap | 0.5rem | .z-cal table | Gap between the table's header and body sections. |
--z-cal-title-font-weight | 500 | .z-cal-title | Font weight of the month and year title. |
i18n Keys
| Key | Default | Placeholders | Description |
|---|---|---|---|
next-month | Next month | — | Accessible label of the next-month button in the header and jumper. Used in: jumper-button, next-button. |
next-year | Next year | — | Accessible label of the jumper's next-year button. Used in: jumper-button. |
prev-month | Previous month | — | Accessible label of the previous-month button in the header and jumper. Used in: jumper-button, previous-button. |
prev-year | Previous year | — | Accessible label of the jumper's previous-year button. Used in: jumper-button. |
select-month | Select month | — | Accessible label of the month dropdown. Used in: month-select. |
select-year | Select year | — | Accessible label of the year input. Used in: year-input. |
Icon Keys
| Key | Icon | Description |
|---|---|---|
chevron-left | Icon on the previous-month and jumper stepper buttons. | |
chevron-right | Icon on the next-month and jumper stepper buttons. |
Events
| Event | Detail | Flags | Description |
|---|---|---|---|
z-calendar:change · from InputMixin | { value: string | string[] } | bubbles | Fires when the selected date changes; detail.value carries the ISO date string. |
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-iso | — | descendant | marker | Full ISO timestamp bound to each day button; used for keyboard navigation and selection. |
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-active | state | .z-cal | State class on the selected day cell. |
.z-cal | root | z-calendar | Root calendar class. |
.z-cal-divider | modifier | .z-cal | Modifier that switches the grid to a divided, row-separated layout. |
.z-cal-header | element | .z-cal | Header bar layout (flex row). |
.z-cal-header-l | element | .z-cal | Left header group that keeps its natural width. |
.z-cal-header-r | element | .z-cal | Right header group that keeps its natural width. |
.z-cal-jumper | element | .z-cal | Jumper layout container. |
.z-cal-jumper-month | element | .z-cal | Month group layout. |
.z-cal-jumper-year | element | .z-cal | Year group layout. |
.z-cal-marked | state | .z-cal | State class on marked day cells; renders the indicator dot. |
.z-cal-oom | state | .z-cal | State class on outside-month day cells (muted). |
.z-cal-title | element | .z-cal | Month and year title styling. |
Keyboard
| Keys | Action | When |
|---|---|---|
| ArrowLeft ArrowRight | Move focus to the previous / next enabled day. | Focus is on a day button |
| ArrowUp ArrowDown | Move focus to the same weekday in the previous / next week, skipping disabled days. | Focus is on a day button |
| Home End | Move focus to the first / last enabled day of the week. | Focus is on a day button |
| PageUp PageDown | Step to the previous / next month. | Focus is on a day button |
| Ctrl+PageUp Ctrl+PageDown Meta+PageUp Meta+PageDown | Step to the previous / next year. | Focus is on a day button |
| Enter | Select the focused day. | Focus is on a day button |
Accessibility
| Part | ARIA | Description |
|---|---|---|
day | aria-selected="dynamic" role="gridcell" | Day cell (gridcell) whose aria-selected reflects selection. |
day-button | aria-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-inner | aria-label="Calendar" role="application" | Calendar root with role="application" and a static aria-label. |
jumper | — | Jumper container. |
jumper-button | aria-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-select | aria-label="dynamic" | Month dropdown labelled by select-month. |
next-button | aria-label="dynamic" | Next-month button labelled by next-month. |
previous-button | aria-label="dynamic" | Previous-month button labelled by prev-month. |
title | — | Month and year title container. |
week | role="row" | Week row (role="row"). |
weekday | role="columnheader" | Weekday header cell (role="columnheader"). |
year-input | aria-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.