Skip to Content
Hookboard

Expressions

The small language used in templates, bindings and conditions.

Expressions are used in four places:

PlaceWritten asExample
Inside text{{ expression }}"Total: {{data.total * 1.24}}"
As a whole value{ "$expr": "expression" }{ "$expr": "data.items.length" }
visibleWhenThe expression itself, no braces"data.errors > 0"
repeat.eachThe expression itself, no braces"data.tasks"

Hookboard's own small interpreter evaluates expressions. They look a lot like JavaScript, but there are no statements, assignments or loops, and no way to reach the page.

What's in scope

NameWhat it is
dataThe card's data
stateThe card's local state
itemThe current item inside a repeat (or the name given by as)
indexThe position of the current item inside a repeat, starting at 0

Syntax

KindForms
Valuesnumbers 12, 3.5; text "hi" or 'hi'; true, false, null; lists [1, 2, 3]
Pathsdata.user.name, data.rows[0], data.map["key"], optional data.user?.name
Arithmetic+ - * / %. + joins text when either side is text.
Comparison== != < <= > >= (=== and !== mean the same as == and !=)
Logic&& || !, and ?? for "use the right side when the left is null"
Choicecondition ? a : b
Callsname(arg, …) using the listed functions only

A missing path gives null and never raises an error. You can only call the listed functions, so a value's own methods, such as text.toUpperCase(), won't work. Use upper(text) instead.

Examples

{
  "data": {
    "used": 412,
    "total": 512,
    "updated": "2026-11-28T09:12:00Z",
    "tags": ["db", "eu"]
  },
  "ui": {
    "type": "stack",
    "children": [
      {
        "type": "progress",
        "value": { "$expr": "round(data.used / data.total * 100)" },
        "label": "Disk",
        "showValue": true
      },
      {
        "type": "text",
        "value": "{{data.total - data.used}} GB free",
        "tone": {
          "$expr": "data.used / data.total > 0.9 ? 'danger' : 'muted'"
        }
      },
      {
        "type": "text",
        "value": "Updated {{relativeTime(data.updated)}}",
        "size": "sm",
        "tone": "muted"
      },
      {
        "type": "badge",
        "repeat": { "each": "data.tags" },
        "label": "{{upper(item)}}"
      }
    ]
  }
}

If an expression can't be parsed, the card is rejected when you send it, with a 422 naming the property and the problem.

On this page