> 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/using-dashboard/definition.md). Agents can also search and read this documentation through its [MCP server](https://docs.rierino.com/~gitbook/mcp).

# Definition

The JSON a dashboard is made of, its sources, items, queries and templates.

A dashboard is a JSON definition, stored in Rierino on the **Data Visualizations** screen. `<Dashboard>` loads it by its id and draws it.

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

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": {
    "type": "RCard",
    "props": { "title": "Top cities", "classes": { "rootExtra": "relative h-72" } },
    "items": [
      {
        "type": "RList",
        "bind": {
          "query": "SELECT city, SUM(revenue) AS revenue FROM orders GROUP BY city ORDER BY revenue DESC"
        },
        "props": {
          "icon": "●",
          "nameField": "city",
          "valueField": "revenue",
          "valueFormat": {
            "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
          }
        }
      }
    ]
  }
}
```

{% 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 %}

## Structure

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": { "type": "RCard", "props": { "title": "Top cities" }, "items": [] }
}
```

| Key       | What it is                                                                                                                         |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `sources` | **Required.** The APIs the data comes from. `[]` for a dashboard without data.                                                     |
| `layout`  | **Required.** The top [item](#items), usually a layout component holding the others.                                               |
| `icons`   | Icons of your own, used by name like the built-in ones. See [Icons](https://docs.rierino.com/sdk-dv-ui/values/icon-stat.md#icons). |

## Sources

```json
{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": { "status": "paid" }, "refresh": 60 }
```

| Key       | What it is                                                                                                                                                        |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key`     | **Required.** The name of the table the source's rows go into, used in queries. Letters, digits and `_`, and not a SQL word such as `order`.                      |
| `url`     | **Required.** The API to request, after the dashboard's `sourcePath` (by default `request/ins_rpc/`). The response's `list` is the rows.                          |
| `params`  | Query parameters added to the request. A [filter](https://docs.rierino.com/sdk-dv-ui/using-dashboard/dashboard.md#filters) value with the same name replaces one. |
| `refresh` | Seconds between new requests. Without it, the source is requested once.                                                                                           |

Each source is requested once per dashboard, however many items read it.

## Items

Every part of the layout is an item:

```json
{
  "type": "RList",
  "bind": { "query": "SELECT city, SUM(revenue) AS revenue FROM orders GROUP BY city" },
  "props": { "nameField": "city", "valueField": "revenue" }
}
```

| Key          | What it is                                                                                               |
| ------------ | -------------------------------------------------------------------------------------------------------- |
| `type`       | **Required.** The component, such as `RCard` or `RECharts`. See the component pages for each one's type. |
| `props`      | The component's settings, listed on its page.                                                            |
| `bind.query` | The [query](#queries) that picks the item's data.                                                        |
| `items`      | The items inside a layout component, in order.                                                           |
| `item`       | A single item inside a layout component, instead of `items`.                                             |

An item without data shows its `sample` prop: rows written in the definition, for designing. A `type` the package doesn't know shows its name instead (see [Empty](https://docs.rierino.com/sdk-dv-ui/layout/empty.md#unknown-types)).

## Queries

`bind.query` is an [AlaSQL](https://github.com/AlaSQL/alasql/wiki/Select) `SELECT` over the sources' tables, each named after its source's `key`. Its rows are the item's data:

```sql
SELECT city, SUM(revenue) AS revenue FROM orders GROUP BY city ORDER BY revenue DESC
```

* The item shows its data once every source the query reads has loaded, and again each time one of them loads again.
* A query can read several sources, for example with a `JOIN`.
* Names that are also SQL words, such as `month` or `value`, go in square brackets: `SELECT [month], SUM(revenue) AS [value] FROM orders GROUP BY [month]`.
* Items inside a [Loop](https://docs.rierino.com/sdk-dv-ui/layout/loop.md) without a query of their own get the loop's rows.

The queries run in the browser, on the rows the sources returned. To read less data, filter the rows in the source's API, for example with [filters](https://docs.rierino.com/sdk-dv-ui/using-dashboard/dashboard.md#filters).

## Templates

Each `type` starts from a built-in template that gives the component its look and default settings. The item's `props` are merged onto it, so an item only sets what is its own:

* objects are merged: `"classes": { "rootExtra": "h-72" }` keeps the template's other classes;
* text, numbers and true / false replace the template's value.

Some types are a template of another component, such as the [E-Charts templates](https://docs.rierino.com/sdk-dv-ui/charts/echarts-templates.md) and the [Plotly presets](https://docs.rierino.com/sdk-dv-ui/charts/plotly-presets.md): an E-Charts or Plotly item with its options already set.


---

# 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/using-dashboard/definition.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.
