> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/sdk-dv-ui/values/annotation.md). Agents can also search and read this documentation through its [MCP server](https://docs.rierino.com/~gitbook/mcp).

# Annotation

Shows a number with a heading and an optional icon.

{% tabs %}
{% tab title="Definition" %}

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": {
    "type": "RGrid",
    "props": { "cols": 3 },
    "items": [
      {
        "type": "RAnnotation",
        "bind": { "query": "SELECT SUM(revenue) AS revenue FROM orders" },
        "props": {
          "icon": "value",
          "header": "Revenue",
          "valueField": "revenue",
          "valueFormat": {
            "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
          },
          "classes": {
            "root": "flex items-center",
            "icon": "w-10 h-10 mr-3",
            "header": "text-lynch text-sm",
            "value": "text-bold-14 text-paris-m"
          }
        }
      },
      {
        "type": "RAnnotation",
        "bind": { "query": "SELECT SUM(orders) AS orders FROM orders" },
        "props": {
          "icon": "quantity",
          "header": "Orders",
          "valueField": "orders",
          "valueFormat": { "options": { "maximumFractionDigits": 0 } },
          "classes": {
            "root": "flex items-center",
            "icon": "w-10 h-10 mr-3",
            "header": "text-lynch text-sm",
            "value": "text-bold-14 text-paris-m"
          }
        }
      },
      {
        "type": "RAnnotation",
        "props": {
          "icon": "discount",
          "header": "Average discount",
          "value": 0.08,
          "valueFormat": { "options": { "style": "percent" } },
          "classes": {
            "root": "flex items-center",
            "icon": "w-10 h-10 mr-3",
            "header": "text-lynch text-sm",
            "value": "text-bold-14 text-paris-m"
          }
        }
      }
    ]
  }
}
```

{% endtab %}

{% tab title="Sample data" %}
The rows the dashboard's sources return.

`orders` (30 rows)

```json
[
  { "month": "2026-07", "city": "Boston", "region": "North", "orders": 40, "revenue": 3200 },
  { "month": "2026-07", "city": "Chicago", "region": "North", "orders": 53, "revenue": 3777 },
  { "month": "2026-07", "city": "Austin", "region": "South", "orders": 41, "revenue": 4354 },
  { "month": "2026-07", "city": "Miami", "region": "South", "orders": 54, "revenue": 4931 },
  { "month": "2026-07", "city": "Denver", "region": "West", "orders": 42, "revenue": 5508 },
  { "month": "2026-08", "city": "Boston", "region": "North", "orders": 47, "revenue": 4291 },
  { "month": "2026-08", "city": "Chicago", "region": "North", "orders": 60, "revenue": 4868 },
  { "month": "2026-08", "city": "Austin", "region": "South", "orders": 48, "revenue": 5445 },
  { "month": "2026-08", "city": "Miami", "region": "South", "orders": 61, "revenue": 3622 },
  { "month": "2026-08", "city": "Denver", "region": "West", "orders": 49, "revenue": 4199 },
  { "month": "2026-09", "city": "Boston", "region": "North", "orders": 54, "revenue": 5382 },
  { "month": "2026-09", "city": "Chicago", "region": "North", "orders": 42, "revenue": 5959 },
  { "month": "2026-09", "city": "Austin", "region": "South", "orders": 55, "revenue": 4136 },
  { "month": "2026-09", "city": "Miami", "region": "South", "orders": 43, "revenue": 4713 },
  { "month": "2026-09", "city": "Denver", "region": "West", "orders": 56, "revenue": 5290 },
  { "month": "2026-10", "city": "Boston", "region": "North", "orders": 61, "revenue": 4073 },
  { "month": "2026-10", "city": "Chicago", "region": "North", "orders": 49, "revenue": 4650 },
  { "month": "2026-10", "city": "Austin", "region": "South", "orders": 62, "revenue": 5227 },
  { "month": "2026-10", "city": "Miami", "region": "South", "orders": 50, "revenue": 5804 },
  { "month": "2026-10", "city": "Denver", "region": "West", "orders": 63, "revenue": 3981 },
  { "month": "2026-11", "city": "Boston", "region": "North", "orders": 43, "revenue": 5164 },
  { "month": "2026-11", "city": "Chicago", "region": "North", "orders": 56, "revenue": 5741 },
  { "month": "2026-11", "city": "Austin", "region": "South", "orders": 44, "revenue": 6318 },
  { "month": "2026-11", "city": "Miami", "region": "South", "orders": 57, "revenue": 4495 },
  { "month": "2026-11", "city": "Denver", "region": "West", "orders": 45, "revenue": 5072 },
  { "month": "2026-12", "city": "Boston", "region": "North", "orders": 50, "revenue": 6255 },
  { "month": "2026-12", "city": "Chicago", "region": "North", "orders": 63, "revenue": 4432 },
  { "month": "2026-12", "city": "Austin", "region": "South", "orders": 51, "revenue": 5009 },
  { "month": "2026-12", "city": "Miami", "region": "South", "orders": 64, "revenue": 5586 },
  { "month": "2026-12", "city": "Denver", "region": "West", "orders": 52, "revenue": 6163 }
]
```

{% endtab %}
{% endtabs %}

## Usage

```json
{
  "type": "RAnnotation",
  "bind": { "query": "SELECT SUM(revenue) AS revenue FROM orders" },
  "props": {
    "icon": "value",
    "header": "Revenue",
    "valueField": "revenue",
    "valueFormat": { "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 } }
  }
}
```

The heading, value and icon are each fixed (`header`, `value`, `icon`) or read from the first row of the data (`headerField`, `valueField`, `iconField`). Fixed values win when both are set. The icon is the name of a [built-in icon](https://docs.rierino.com/sdk-dv-ui/values/icon-stat.md#icons).

`valueFormat` takes the [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) options as `options`, and an optional `locales` (default `en-US`). Without it, values show with two decimals.

The built-in look has no spacing or sizes, so set them in `classes`, as in the example:

```json
{
  "classes": {
    "root": "flex items-center",
    "icon": "w-10 h-10 mr-3",
    "header": "text-lynch text-sm",
    "value": "text-bold-14 text-paris-m"
  }
}
```

## Props

| Prop          | Type                    | Default                                               | Description                                     |
| ------------- | ----------------------- | ----------------------------------------------------- | ----------------------------------------------- |
| `header`      | `string`                |                                                       | Fixed heading.                                  |
| `value`       | `number`                |                                                       | Fixed value.                                    |
| `icon`        | `string`                |                                                       | Name of the icon to show.                       |
| `headerField` | `string`                | `"header"`                                            | Field the heading is read from.                 |
| `valueField`  | `string`                | `"value"`                                             | Field the value is read from.                   |
| `iconField`   | `string`                | `"icon"`                                              | Field the icon name is read from.               |
| `valueFormat` | `{ locales?, options }` |                                                       | How the value is formatted, see above.          |
| `sample`      | `object`                | `{ icon: "value", header: "Header", value: "Value" }` | Row shown when there is no data, for designing. |
| `classes`     | `object`                |                                                       | Class names for the parts, see Classes below.   |

In the Rierino designer: **Header**, **Value**, **Icon**, **Header Field**, **Value Field**, **Icon Field** and **Classes**. `valueFormat` can be set in the component's props JSON.

## Classes

| Part     | Built-in classes                              | Styles         |
| -------- | --------------------------------------------- | -------------- |
| `root`   | `flex`                                        | The annotation |
| `icon`   | none                                          | The icon       |
| `header` | `flex items-center tracking-[0.2px] pb-[5px]` | The heading    |
| `value`  | none                                          | The value      |

Set `classes.<part>` to replace the built-in classes, or `classes.<part>Extra` to add to them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rierino.com/sdk-dv-ui/values/annotation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
