Skip to content

Show answers and values

A Value shows one fact under its label: an answer on a wizard’s review page, a field of a record, a setting. It is read-only. Fill in the first page, then open Review: each answer is one Value, and the track and topics show the options the person picked, not the values stored for them.

Prop Takes Shows
label Text Above the value, in the pack’s label style
value Text, a $state read, inside a list template an $item or $index read, a $format of a read, a display-only $calc (or a $format of one), a number or text $expr (or a $format of a number $expr), or in Signal a $label read The value; a list (a checkboxes value read with $state) is joined with commas, a $format shows it as a number, money, a percent, a date or a count, a $calc shows a number calculated from state, such as a total, and a number or text $expr shows a typed formula (arithmetic, or if choosing between values; comparisons only inside if’s condition). A boolean $expr is refused here
empty Text, optional In place of the value while it is missing, null, empty text or an empty list, or while a $calc or $expr has no value; without it nothing shows
error One $state read, optional Under the value while it holds non-empty text, as a form control’s error
{
"review-name": {
"type": "Value",
"props": { "label": "Name", "value": { "$state": "/form/name" }, "empty": "Not given" },
"children": []
}
}

The Value is a group named by its label, so a screen reader announces “Name, Jordan”. While error holds a message the group is described by it. Both packs have Value; in the designer it is in the palette’s Content group (Nocturne: Editorial).

A number or text $expr on value (or on Text / Heading content) is a typed formula, not $calc: arithmetic, or if choosing between values; comparisons only inside if’s condition. A boolean $expr is refused here. When the prop already holds one, the Inspector is in formula mode: a Formula · … summary, Remove, and the formula editor (function, operands, Add operand). The usual binding-mode buttons stay (none pressed); choosing one replaces the formula. Calculate still creates $calc. A formula arrives from import or AI mode; once it is there you edit it in place. Boolean $expr belongs on Show when and $cond, not on a displayed value. See formulas for true and false and $expr.

A Choice stores its options’ values ("workshop"), which are written for the host, not for people. To show the label the person picked instead (“Workshop (hands-on, lunch included)”), read the Choice by its element key:

{ "label": "Track", "value": { "$label": "track" }, "empty": "Not chosen" }

{ "$label": "<key>" } shows the label of the option chosen in that Choice, and follows it on every page as the person changes their mind. For checkboxes it shows every chosen label, in the order of the options, separated by commas. While nothing is chosen it shows nothing, so a Value shows its empty text. A stored value that no option has is shown as it is.

The rules, which import checks:

  • The key must name a Choice whose value is bound with $bindState. A Choice with a fixed value, or one inside a list template (bound with $bindItem, one choice per row), has no single choice to show.
  • $label is a display read. Only Text content and Value value take it, and only in Signal, the pack with Choice. Conditions, $cond props, bindings and action params never do: a condition or a host input reads the stored value with $state.
  • Deleting the Choice, or a container holding it, is refused while a $label read of it remains; the refusal names the Choice and every element and prop that reads it. Change those reads (to a $state read, or another Choice) first.

In the designer, select a Text or a Value that reads State at a path a Choice binds: a Value / Label switch under the path chooses between the stored value and the chosen option’s label. Under Label the path is read-only; to read another Choice, switch to Value, change the path, and switch back. A formatted read has no switch: set Format as back to None first. The canvas shows the label of the option the document’s state chooses, or a placeholder naming the Choice while none is chosen.

$label works wherever a host renders the document inside PageProvider, which every host already does to select pages; that is where Mica finds the Choice the read names. See embed in a host.

When the last page of a wizard sends a create, a refused create leaves the person on that page. Give each answer’s Value the error of the input it shows, from the same path as the control on its own step:

{
"label": "Track",
"value": { "$label": "track" },
"error": { "$state": "/meta/objects/signup/operations/create/error/fieldErrors/track" }
}

In the Inspector, a Value’s Field error offers Show field error for… each create or update input that sends the value the Value shows, whether it reads it with $state (formatted or not) or through $label. An object action’s Show field error sets it on those Values as well as on the controls the input is sent from. The playbook’s wizard pages recipe is a complete example; see also forms.