CUI

Components / Developer tools

Key-value editor

Rows of key and value fields for HTTP headers, query parameters or environment variables.

Functions: cui_kv_editor

Key-value editor

Usage

static cui_kv_pair headers[16] = { { "Accept", "application/json", true } };
static int count = 1;

if (cui_kv_editor(ui, "headers", headers, &count, 16))
    rebuild_request();

You own the array, and it is edited in place. The checkbox turns a pair on or off, typing in the empty row at the end adds a pair, and the x removes one. The lock marks a value as secret: it shows as dots, and the field's eye reveals it. A key used twice by enabled pairs, or one with a space in it, is marked under its field. Below 480 points each key sits above its value.

Keyboard

  • Tab moves through each row's checkbox, key, value, lock and remove button. The fields edit like any text field, and Enter or Space presses the focused checkbox or button.

Options of cui_kv_editor

OptionTypeDefaultDescription
.key_placeholderconst char *"Key"default "Key"
.value_placeholderconst char *"Value"default "Value"
.no_togglesboolno checkboxes: every pair is on
.no_secretsboolno eye button
.read_onlyboolShows the value but does not let it be edited.
.widthcui_sizefilldefault fill

cui_kv_pair

FieldTypeDescription
keychar[64]the name, e.g. "Accept"; edited in place
valuechar[256]the value, e.g. "application/json"; edited in place
enabledboolthe pair is in use; its checkbox toggles this
secretboolthe value shows as dots, with an eye to reveal it; the lock button toggles this

Related

  • Problems panel: Compiler and linter output grouped by file, with each file's count.
  • Pipeline: A CI or CD run: each stage is a column of its jobs with their status and duration, and connectors run between the stages.
  • Query builder: A filter built from conditions joined by all or any, in groups that nest.
  • Schedule picker: A cron schedule edited through plain choices instead of the expression, with the next runs listed.