inputshwc
z-kvKey-Value Editor
Editable key/value table with add/remove rows, value masking, random value generation, and row limits.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
noninsertable | boolean | false | Hides the add-row affordances and blocks inserting rows. |
max | number | 0 | Maximum number of rows (0 = unlimited). |
min | number | 1 | Minimum number of rows; removal is blocked at the limit (default 1). |
aria-label | string | '' | Accessible label of the table (defaults to the table-label i18n text). |
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 |
|---|---|---|---|---|
actions | z-kv-actions | yes | yes | Row actions group (default z-kv-actions). |
add-button | z-button z-button-default | yes | yes | Add-row button (default z-button z-button-default). |
add-cell | — | yes | yes | Add-row table cell. |
add-row | — | yes | yes | Add-row table row. |
add-wrapper | z-kv-add-wrapper | yes | yes | Add-row wrapper (default z-kv-add-wrapper). |
button | z-button z-button-default z-button-icon | yes | no | Base row-action button styling. |
data-actions | z-table-shrink | yes | yes | Row actions cell. |
data-key | — | yes | yes | Key cell. |
data-value | — | yes | yes | Value cell. |
header-actions | z-table-shrink | yes | yes | Actions column header. |
header-key | — | yes | yes | Key column header. |
header-row | — | yes | yes | Row holding the column headers. |
header-value | — | yes | yes | Value column header. |
host-inner | z-kv | yes | yes | Editor root (default z-kv); the default cls/stl target. |
input | z-input | yes | no | Shared input styling class (default z-input). |
key-input | — | yes | no | Key text input. |
random-button | — | yes | no | Random value generator button. |
remove-button | z-button z-button-danger z-button-outline z-button-icon | yes | no | Row remove button (default danger outline icon button). |
row | — | yes | yes | One data row. |
table | z-table z-table-divider z-table-responsive | yes | yes | The key/value table (default z-table z-table-divider z-table-responsive). |
textarea | z-textarea | yes | no | Shared textarea styling class (default z-textarea). |
toggle-button | — | yes | no | Value visibility toggle button. |
value-input | z-input | yes | no | Value text input. |
value-textarea | z-textarea | yes | no | Value textarea (multiline values). |
value-wrapper | z-kv-value-wrapper | yes | yes | Value field wrapper (default z-kv-value-wrapper). |
CSS Variables
| Variable | Default | Scope | Description |
|---|---|---|---|
--z-kv-border-color | var(--z-border) | .z-kv | Border base color, mixed with transparency using --z-kv-border-color-o. |
--z-kv-border-color-o | 10% | .z-kv | Border opacity percentage used in the border color mix. |
i18n Keys
| Key | Default | Placeholders | Description |
|---|---|---|---|
actions-label | — | Accessible label of the actions group. Used in: actions, header-actions. | |
add-button-text | — | Add-row button text. Used in: add-button. | |
add-row-label | — | Accessible label of the add button. Used in: add-button. | |
generate-random-label | — | Accessible label of random-value buttons. Used in: random-button. | |
header-key | — | Key column header text. Used in: header-key. | |
header-value | — | Value column header text. Used in: header-value. | |
key-label | — | Accessible label of key inputs. Used in: key-input. | |
placeholder-key | — | Placeholder of key inputs. Used in: key-input. | |
placeholder-value | — | Placeholder of value inputs. Used in: value-input, value-textarea. | |
remove-row-label | — | Accessible label of remove buttons. Used in: remove-button. | |
table-label | — | Accessible label of the table. Used in: table. | |
toggle-visibility-label | — | Accessible label of visibility toggles. Used in: toggle-button. | |
value-label | — | Accessible label of value inputs. Used in: value-input, value-textarea. |
Icon Keys
| Key | Icon | Description |
|---|---|---|
eye | Show-value toggle icon. | |
eye-off | Hide-value toggle icon. | |
plus | Add-row button icon. | |
trash-2 | Remove-row button icon. | |
wand | Random-value button icon. |
Data Hooks
| Attribute | Values | Applies to | Role | Description |
|---|---|---|---|---|
data-action | — | descendant | marker | Marks row action buttons. |
data-field | key, value | descendant | marker | Marks key/value fields (key or value). |
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 | add-button | descendant | marker | Marks the add button in adopted server-rendered DOM (data-part="add-button"). |
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. |
data-row-index | — | descendant | marker | Set by the component on each row to its index. |
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. |
data-key | no | string | Explicit key for this row; defaults to the option text when it differs from the 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. |
data-key | no | string | Explicit key for this row; defaults to the option text when it differs from the value. |
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 | state | .z-kv | Input styling applied to key/value fields. |
.z-kv | root | z-kv | Root class of the editor. |
.z-kv-actions | state | .z-kv | Row actions group layout. |
.z-kv-add-wrapper | state | .z-kv | Add-row wrapper layout. |
.z-kv-value-wrapper | state | .z-kv | Value field wrapper layout. |
.z-textarea | state | .z-kv | Textarea styling applied to multiline values. |
Keyboard
| Keys | Action | When |
|---|---|---|
| Mod+Enter | Adds a new row (unless noninsertable). | — |
Accessibility
| Part | ARIA | Description |
|---|---|---|
actions | aria-label="${actionsLabel}" role="group" | Actions group: role="group" labeled by actions-label. |
add-button | aria-label="${addRowLabel}" | Add button labeled by add-row-label. |
add-cell | role="cell" | Add cell: role="cell". |
add-row | role="row" | Add row: role="row". |
add-wrapper | — | Add-row wrapper; no ARIA attributes. |
data-actions | role="cell" | Actions cell: role="cell". |
data-key | role="cell" | Key cell: role="cell". |
data-value | role="cell" | Value cell: role="cell". |
header-actions | role="columnheader" | Actions header: role="columnheader". |
header-key | role="columnheader" | Key header: role="columnheader". |
header-row | role="row" | Header row: role="row". |
header-value | role="columnheader" | Value header: role="columnheader". |
host-inner | — | Editor root; no static ARIA attributes. |
key-input | aria-label="${keyLabel}" | Key input labeled by key-label. |
random-button | aria-label="${randomLabel}" | Random-value button labeled by generate-random-label. |
remove-button | aria-label="${removeLabel}" | Remove button labeled by remove-row-label. |
row | role="row" | Data row: role="row". |
table | aria-label="${tableLabel}" role="table" | Table: role="table" labeled by table-label. |
toggle-button | aria-label="${toggleLabel}" aria-pressed="${isVisible ? 'true' : 'false'}" | Visibility toggle labeled by toggle-visibility-label, aria-pressed reflects visibility. |
value-input | aria-label="${valueLabel}" | Value input labeled by value-label. |
value-textarea | aria-label="${valueLabel}" | Value textarea labeled by value-label. |
value-wrapper | — | Value wrapper; no ARIA attributes. |
- The editor is a labeled ARIA table; every input and action button carries an i18n-backed label.