inputshwc
z-input-pinPIN Input
Segmented one-character fields for verification codes, with auto-advance, paste distribution, and completion events.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
autofocus | boolean | false | Focuses the first field on mount. |
length | number | 6 | Number of digit fields (default 6). |
input-mode | 'numeric' | 'text' | 'numeric' | Virtual keyboard mode: numeric (default) or text. |
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:wrapper · defaultstl target:wrapper
| Key | Default class | cls | stl | Description |
|---|---|---|---|---|
description | sr-only | yes | yes | Group description (default sr-only). |
host-inner | — | yes | yes | Rendered root wrapper. |
input | — | yes | yes | One single-character field. |
label | sr-only | yes | yes | Group label (default sr-only). |
wrapper | z-input-pin | yes | yes | The fields wrapper (default z-input-pin); the default cls/stl target. |
CSS Variables
| Variable | Default | Scope | Description |
|---|---|---|---|
--z-input-pin-focus-ring-color | var(--z-focus) | .z-input-pin | Focus ring base color, mixed with transparency using --z-input-pin-focus-ring-color-o. |
--z-input-pin-focus-ring-color-o | 100% | .z-input-pin | Focus ring opacity percentage used in the mix. |
--z-input-pin-input-border-color | var(--z-input) | .z-input-pin input | Field border base color, mixed with transparency using --z-input-pin-input-border-color-o. |
--z-input-pin-input-border-color-o | var(--z-input-o) | .z-input-pin input | Field border opacity percentage used in the mix. |
--z-input-pin-radius | var(--z-form-input-radius) | .z-input-pin | Corner radius of the fields. |
--z-input-pin-separated-gap | 0.5rem | .z-input-pin.z-input-pin-separated | Gap between separated fields. |
--z-input-pin-separated-input-shadow | var(--z-form-input-shadow) | .z-input-pin.z-input-pin-separated | Box shadow of each separated field. |
--z-input-pin-shadow | var(--z-form-input-shadow) | .z-input-pin | Box shadow of the joined field. |
i18n Keys
| Key | Default | Placeholders | Description |
|---|---|---|---|
complete | PIN entry complete | — | Announcement when all fields are filled. |
description | Enter {length}-digit code | length | Group description template with {length}. |
field-filled | Field {n} filled | n | Announcement template when a field is filled, with {n}. |
field-label | Digit {n} of {total} | n, total | Per-field label template with {n} and {total}. |
label | PIN Code | — | Accessible group label. |
loaded | PIN input ready | — | Announcement when the input is ready. |
Events
| Event | Detail | Flags | Description |
|---|---|---|---|
z-input-pin:change · from InputMixin | { value: string | string[] } | bubbles | Fires when the committed code changes; detail.value carries the joined code. |
z-input-pin:complete | { value: string } | bubbles | Fires when every field is filled; detail.value carries the joined code. |
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-pin-input | — | descendant | marker | Marks each single-character field. |
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-input-pin | root | z-input-pin | Root class of the fields wrapper. |
.z-input-pin-separated | modifier | .z-input-pin | Separated presentation: individual boxed fields with a gap. |
Keyboard
| Keys | Action | When |
|---|---|---|
| ArrowLeft ArrowRight | Move between fields. | — |
| Backspace | Clears the current field and steps back. | — |
Accessibility
| Part | ARIA | Description |
|---|---|---|
description | — | Visually hidden group description. |
host-inner | aria-labelledby="${this.groupId}-label ${this.groupId}-desc" role="group" | Group container: role="group" labeled by the label and description. |
input | aria-label="dynamic" | Single-character field with a per-digit aria-label. |
label | — | Visually hidden group label. |
wrapper | role="presentation" | Fields wrapper: role="presentation". |
- The group is labeled and described; each field announces its digit position, and completion is announced politely.
- Pasted codes are distributed across the fields.