Skip to content

DisplayRule

Where this goes: An entry in input.rules.

Read the practical guide · See an illustrated example.

The tables below list configuration keys. Required means the key must be present in the config; it does not mean a labeler must answer the field.

A purely visual rule over displayed input values. Rules never affect what is exported — that guarantee is structural, since the module evaluating them is never imported on the export path.

Key Type Required Notes
name string yes Identifies the rule; shown in diagnostics and used as a stable render key. min length 1, matches ^[A-Za-z0-9_-][A-Za-z0-9_ -]*[A-Za-z0-9_-]$|^[A-Za-z0-9_-]$
when Condition yes The condition that fires this rule.
appliesTo array of string no Fields to style when the rule fires. Defaults to the field the condition tests, which is what you want for a single-field rule and never what you want when comparing two. The default is skipped entirely when appliesToCards is given. at least 1 item
appliesToCards array of string no Input cards to annotate when the rule fires. A card-level note states once what would otherwise repeat on every field in the group. This is a separate key from appliesTo because card names and field names live in separate namespaces — a card may legitimately share a name with a field, and one list could not tell them apart. at least 1 item
forEach string no Evaluate this rule once per element of the named input field, which must be an array, and style the elements it holds for. Inside the loop, an element of an array of object is addressed by its own field names, which shadow a record column of the same name; an element of a list of scalars is addressed by the list’s own name. Either way every other record column stays readable, so otherField compares an element against the record around it. Cannot be combined with appliesTo or appliesToCards — the target is always the matching element. min length 1, matches ^[A-Za-z0-9_-][A-Za-z0-9_ -]*[A-Za-z0-9_-]$|^[A-Za-z0-9_-]$
style Style yes How the matched fields are styled.