Key/value editor

Key/value editor for lit-material: labels, annotations and environment variables, with duplicate and pattern checks and KEY=value paste.

  • 7.8 KB gzipped
  • @lit-material/key-value 0.1.5
  • Renders on the server

Example

Install

npm install @lit-material/key-value @lit-material/tokens
import "@lit-material/key-value";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-key-value-editor>

Edits an ordered list of key/value pairs: labels, annotations, environment variables, headers. Each row is a key field, a value field and a remove button; "Add" appends a row and focuses its key.

Properties

PropertyAttributeTypeDefaultDescription
keyLabelkey-labelstring"Key"Label of the key fields.
valueLabelvalue-labelstring"Value"Label of the value fields.
addLabeladd-labelstring"Add"Label of the add button.
keyPatternkey-patternstring""A regular expression (whole key) every key must match.
keyPatternMessagekey-pattern-messagestring"Invalid key"Error shown when a key doesn't match key-pattern.
maskValuesmask-valuesbooleanfalseShow values as password fields, e.g. secrets.
disableddisabledbooleanfalse
readonlyreadonlybooleanfalse
entriesproperty onlyKeyValueEntry[]noneThe pairs, in order, without blank rows. Setting it replaces every row.
validproperty onlybooleannonetrue when no row has an error.

Events

EventDescription
changeAfter any edit, add or remove; detail is { entries }.

CSS parts

PartDescription
rowOne key/value row.
addThe add button.

Source on GitHub npm