Skip to content

Record

Loads one record with a get operation and shows its children for it.

Use it for: A detail screen, the head of a page, or a dashboard of totals that a database view works out. Its children show the record’s fields the way a list row does. If the record isn’t there, emptyText is shown.

  • CategoryData
  • ChildrenAny number
  • DataA get operation (bindings.record)
  • ActionNone
Prop Required Accepts What it does
emptyText Yes text, up to 200 characters Shown when there are no rows.

Every component also accepts id (required, unique on its screen), and the optional preset and style described in Style options. Every component except Screen accepts when, described in Data-driven look.

From the Northline Builders example project:

{
"id": "home-totals",
"type": "Record",
"props": {
"emptyText": "Totals aren’t available yet."
},
"children": [
{
"id": "home-figures",
"type": "Grid",
"props": {
"columns": 2
},
"children": [
{
"id": "active",
"type": "Card",
"props": {},
"preset": "panel",
"children": [
{
"id": "active-label",
"type": "Text",
"props": {
"text": "Active projects"
},
"preset": "note"
},
{
"id": "active-value",
"type": "Text",
"props": {
"format": {
"style": "number",
"decimals": 0
}
},
"preset": "figure",
"bindings": {
"value": {
"model": "dashboard",
"field": "active-projects"
}
}
}
]
},
{
"id": "overdue",
"type": "Card",
"props": {},
"preset": "panel",
"children": [
{
"id": "overdue-label",
"type": "Text",
"props": {
"text": "Overdue"
},
"preset": "note"
},
{
"id": "overdue-value",
"type": "Text",
"props": {
"format": {
"style": "number",
"decimals": 0
}
},
"preset": "figure",
"bindings": {
"value": {
"model": "dashboard",
"field": "overdue-projects"
}
}
}
]
},
{
"id": "budget-all",
"type": "Card",
"props": {},
"preset": "panel",
"children": [
{
"id": "budget-all-label",
"type": "Text",
"props": {
"text": "Total budget"
},
"preset": "note"
},
{
"id": "budget-all-value",
"type": "Text",
"props": {
"format": {
"style": "currency",
"currency": "USD",
"decimals": 0,
"compact": true
}
},
"preset": "figure",
"bindings": {
"value": {
"model": "dashboard",
"field": "total-budget"
}
}
}
]
},
{
"id": "spent-all",
"type": "Card",
"props": {},
"preset": "panel",
"children": [
{
"id": "spent-all-label",
"type": "Text",
"props": {
"text": "Spent so far"
},
"preset": "note"
},
{
"id": "spent-all-value",
"type": "Text",
"props": {
"format": {
"style": "currency",
"currency": "USD",
"decimals": 0,
"compact": true
}
},
"preset": "figure",
"bindings": {
"value": {
"model": "dashboard",
"field": "total-spent"
}
}
}
]
}
],
"style": {
"gap": "$spacing.sm"
}
},
{
"id": "home-late",
"type": "Card",
"props": {},
"preset": "alert",
"children": [
{
"id": "home-late-line",
"type": "Row",
"props": {},
"preset": "line",
"children": [
{
"id": "home-late-icon",
"type": "Icon",
"props": {
"name": "warning",
"label": "Overdue"
},
"style": {
"color": "$color.primary"
}
},
{
"id": "home-late-words",
"type": "Text",
"props": {
"text": "Some projects are past their due date."
},
"preset": "label"
}
]
}
],
"when": {
"model": "dashboard",
"field": "overdue-projects",
"is": {
"source": "literal",
"value": 0,
"compare": "gt"
}
}
}
],
"bindings": {
"record": {
"operationId": "get-dashboard",
"parameters": {}
}
}
}