# Number card

> Canonical HTML: https://screenrig.ai/docs/cards/number/

One big value with a label, a prefix and a suffix in their own colours, plus a change.

One big value with its label is set large and clear, made to be read from across a room. It fills the screen, sits in the middle, tucks into a corner, runs as one line, or runs as a band along an edge. You set the label, a prefix and a suffix each in its own colour, grouping and abbreviation for long figures, a change shown with an arrow and a good or bad tone, and a count from the previous value.

## Live card

This card is drawn in your browser by the same code the Players run, with sample data.

Category: Operations. Tags: Numbers and metrics, Prices and rates.

## Layouts

This core card fits every layout: full screen, center, corner, chip, strip, or any free rectangle.

Layouts: full, center, corner, chip, strip. Forms: landscape, portrait, square, strip.

[Card layouts, themes and publishing](/docs/cards/). [Browse the cards](/apps/#cards).

## Data and privacy

This card uses its configured properties and live card data.

## Properties

For theme, background, accent and position, see [Common properties](/docs/cards/#common-properties).

Set static properties in `params`. Bind `data` to a project card data key for live values; that document holds only dynamic properties. Without a data key, put the complete configuration in `params`. Nested rows describe the contents of their parent property.

### Static properties

| Name | Type | Default | Values and limits | Description |
| --- | --- | --- | --- | --- |
| `prefix` | string | `""` | maxLength: `6` | Drawn before the number, smaller: a currency symbol. |
| `prefixColor` | string, null | `null` | pattern: `"^(#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?\|base\|text\|muted\|faint\|accent\|accent2\|accent3\|onAccent\|surface\|surfaceStrong\|stroke\|highlight\|danger\|warning\|success\|cool\|warm)$"` | A palette key (accent, muted, text, success, danger, warm ...) or a #RRGGBB colour. null: accent. |
| `suffix` | string | `""` | maxLength: `8` | Drawn after the number, smaller: a unit or a percent sign. |
| `suffixColor` | string, null | `null` | pattern: `"^(#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?\|base\|text\|muted\|faint\|accent\|accent2\|accent3\|onAccent\|surface\|surfaceStrong\|stroke\|highlight\|danger\|warning\|success\|cool\|warm)$"` | A palette key or a #RRGGBB colour. null: muted. |
| `decimals` | integer, null | `null` | minimum: `0`; maximum: `4` | Digits after the point. null: as many as the value needs, up to two (one when abbreviated). |
| `grouping` | boolean | `true` |  | Thousands separators (1,284). |
| `compact` | string | `"auto"` | `"auto"`, `"always"`, `"never"` | Abbreviate thousands, millions, billions and trillions (1.2K, 3.4M). auto does it when the full number would crowd the box. |
| `sign` | string | `"auto"` | `"auto"`, `"always"`, `"negative"` | auto: a minus on a negative value that does not round to zero. always: a plus on positive values too. negative: a minus only on a negative value, as auto. |
| `changeUnit` | string | `"%"` | maxLength: `6` | Follows the change: % or a unit; empty for the bare number. |
| `goodWhen` | string | `"up"` | `"up"`, `"down"` | Which direction of change is good (down for wait times and costs). |

### Dynamic properties

| Name | Type | Default | Values and limits | Description |
| --- | --- | --- | --- | --- |
| `value` | number, null | `null` | minimum: `-1000000000000000.0`; maximum: `1000000000000000.0` | The big number. null shows a dash. |
| `label` | string | `""` | maxLength: `40` | What the number is. |
| `change` | number, null | `null` | minimum: `-1000000000000000.0`; maximum: `1000000000000000.0` | How much the value moved, shown with an arrow and a good or bad tone. |
| `changeLabel` | string | `""` | maxLength: `30` | What the change is against: vs last week. |
| `previous` | number, null | `null` | minimum: `-1000000000000000.0`; maximum: `1000000000000000.0` | The value before it changed. With changedAt, every screen counts from it to the value together. |
| `changedAt` | string, null | `null` |  | ISO 8601 instant the value changed. With previous, the number counts up or down from that instant. |

## Canvas example

Add this item to a playlist page’s `primitives`. [Publish the playlist and assign a screen](/docs/cards/#publish-a-card-canvas).

```json
{
  "id": "number",
  "primitive": "card",
  "card": "number",
  "major": 1,
  "params": {
    "theme": "neomustard"
  },
  "rect": {
    "x": 0,
    "y": 0,
    "width": 1920,
    "height": 1080
  },
  "layer": 0,
  "content_fit": "fill",
  "data": "example-key"
}
```

## Write live data

The canvas example binds its `data` field to `example-key`. That value is a data key: a name this canvas item chooses, not the name of the card. Give each canvas item its own key when items should show different data, or share one key when they should show the same data. Keys are scoped to the project, follow the K/V key grammar, and cannot start with `feed:`.

Create this document before showing the card, then replace it to update the screen without republishing. Writes to a key that live canvas items bind are checked against each bound card’s dynamic properties. Use the same project as the playlist.

Save the document as `card-data.json`. The CLI reads the document itself, with no wrapper:

```json
{
  "value": null,
  "label": "",
  "change": null,
  "changeLabel": "",
  "previous": null,
  "changedAt": null
}
```

```console
screenrig card-data put example-key --file card-data.json
```

Or call the API directly. The API wraps the same document in a `document` field. An agent token already names its project, so no project header is sent; if you send `ScreenRig-Project`, it must match the token’s project. Supply your API authorization through the environment; see [API authentication](/docs/authentication/).

```console
curl --request PUT "https://api.screenrig.ai/api/card-data/example-key" \
  --header "Authorization: Bearer $SCREENRIG_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{"document":{"value":null,"label":"","change":null,"changeLabel":"","previous":null,"changedAt":null}}'
```
