inputshwcz-kv

Key-Value Editor

Editable key/value table with add/remove rows, value masking, random value generation, and row limits.

Attributes

AttributeTypeDefaultDescription
noninsertablebooleanfalseHides the add-row affordances and blocks inserting rows.
maxnumber0Maximum number of rows (0 = unlimited).
minnumber1Minimum number of rows; removal is blocked at the limit (default 1).
aria-labelstring''Accessible label of the table (defaults to the table-label i18n text).
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
actionsz-kv-actionsyesyesRow actions group (default z-kv-actions).
add-buttonz-button z-button-defaultyesyesAdd-row button (default z-button z-button-default).
add-cell—yesyesAdd-row table cell.
add-row—yesyesAdd-row table row.
add-wrapperz-kv-add-wrapperyesyesAdd-row wrapper (default z-kv-add-wrapper).
buttonz-button z-button-default z-button-iconyesnoBase row-action button styling.
data-actionsz-table-shrinkyesyesRow actions cell.
data-key—yesyesKey cell.
data-value—yesyesValue cell.
header-actionsz-table-shrinkyesyesActions column header.
header-key—yesyesKey column header.
header-row—yesyesRow holding the column headers.
header-value—yesyesValue column header.
host-innerz-kvyesyesEditor root (default z-kv); the default cls/stl target.
inputz-inputyesnoShared input styling class (default z-input).
key-input—yesnoKey text input.
random-button—yesnoRandom value generator button.
remove-buttonz-button z-button-danger z-button-outline z-button-iconyesnoRow remove button (default danger outline icon button).
row—yesyesOne data row.
tablez-table z-table-divider z-table-responsiveyesyesThe key/value table (default z-table z-table-divider z-table-responsive).
textareaz-textareayesnoShared textarea styling class (default z-textarea).
toggle-button—yesnoValue visibility toggle button.
value-inputz-inputyesnoValue text input.
value-textareaz-textareayesnoValue textarea (multiline values).
value-wrapperz-kv-value-wrapperyesyesValue field wrapper (default z-kv-value-wrapper).

CSS Variables

VariableDefaultScopeDescription
--z-kv-border-colorvar(--z-border).z-kvBorder base color, mixed with transparency using --z-kv-border-color-o.
--z-kv-border-color-o10%.z-kvBorder opacity percentage used in the border color mix.

i18n Keys

KeyDefaultPlaceholdersDescription
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

KeyIconDescription
eyeShow-value toggle icon.
eye-offHide-value toggle icon.
plusAdd-row button icon.
trash-2Remove-row button icon.
wandRandom-value button icon.

Data Hooks

AttributeValuesApplies toRoleDescription
data-action—descendantmarkerMarks row action buttons.
data-fieldkey, valuedescendantmarkerMarks key/value fields (key or value).
data-host-inner · from Hwc—descendantconfigMarks the rendered inner wrapper so force-prevent-rerender can adopt server-rendered DOM without re-rendering.
data-partadd-buttondescendantmarkerMarks the add button in adopted server-rendered DOM (data-part="add-button").
data-reactive · from Hwc—descendantconfigOpts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates.
data-row-index—descendantmarkerSet 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).

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.
data-keynostringExplicit key for this row; defaults to the option text when it differs from the 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.
data-keynostringExplicit key for this row; defaults to the option text when it differs from the value.

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-inputstate.z-kvInput styling applied to key/value fields.
.z-kvrootz-kvRoot class of the editor.
.z-kv-actionsstate.z-kvRow actions group layout.
.z-kv-add-wrapperstate.z-kvAdd-row wrapper layout.
.z-kv-value-wrapperstate.z-kvValue field wrapper layout.
.z-textareastate.z-kvTextarea styling applied to multiline values.

Keyboard

KeysActionWhen
Mod+EnterAdds a new row (unless noninsertable).—

Accessibility

PartARIADescription
actionsaria-label="${actionsLabel}" role="group"Actions group: role="group" labeled by actions-label.
add-buttonaria-label="${addRowLabel}"Add button labeled by add-row-label.
add-cellrole="cell"Add cell: role="cell".
add-rowrole="row"Add row: role="row".
add-wrapper—Add-row wrapper; no ARIA attributes.
data-actionsrole="cell"Actions cell: role="cell".
data-keyrole="cell"Key cell: role="cell".
data-valuerole="cell"Value cell: role="cell".
header-actionsrole="columnheader"Actions header: role="columnheader".
header-keyrole="columnheader"Key header: role="columnheader".
header-rowrole="row"Header row: role="row".
header-valuerole="columnheader"Value header: role="columnheader".
host-inner—Editor root; no static ARIA attributes.
key-inputaria-label="${keyLabel}"Key input labeled by key-label.
random-buttonaria-label="${randomLabel}"Random-value button labeled by generate-random-label.
remove-buttonaria-label="${removeLabel}"Remove button labeled by remove-row-label.
rowrole="row"Data row: role="row".
tablearia-label="${tableLabel}" role="table"Table: role="table" labeled by table-label.
toggle-buttonaria-label="${toggleLabel}" aria-pressed="${isVisible ? 'true' : 'false'}"Visibility toggle labeled by toggle-visibility-label, aria-pressed reflects visibility.
value-inputaria-label="${valueLabel}"Value input labeled by value-label.
value-textareaaria-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.