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

# Quick start

Show a Rierino dashboard in your own React app.

This page assumes the packages are [installed](https://docs.rierino.com/sdk-dv-ui/getting-started/installation.md) and that a dashboard exists on the Data Visualizations screen of your Rierino server.

{% stepper %}
{% step %}

### Create a client

The client sets the server and how requests are signed. Create it once, outside your components: a new client makes the dashboard load again from the start.

{% code title="lib/rierino.ts" %}

```ts
import { createClient } from '@rierino-open/api-client';

export const client = createClient({
  baseUrl: 'https://your-rierino-host/api/',
  auth: { type: 'token', token: () => getUserToken() },
});
```

{% endcode %}

`token` is read for each request, so it can return a refreshed token. The api-client also supports cookies, API keys and custom headers.
{% endstep %}

{% step %}

### Show the dashboard

Pass the client and the id of the data visualization:

{% code title="components/sales-dashboard.tsx" %}

```tsx
import { Dashboard } from '@rierino-open/dv';
import '@rierino-open/dv/styles.css';
import { client } from '@/lib/rierino';

export function SalesDashboard() {
  return <Dashboard client={client} id="store-overview" />;
}
```

{% endcode %}
{% endstep %}
{% endstepper %}

The dashboard loads its definition, then its sources, and shows each component as its data arrives:

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

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {}, "refresh": 0 }],
  "layout": {
    "type": "RCol",
    "items": [
      {
        "type": "RGrid",
        "props": { "cols": 3 },
        "items": [
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "bind": {
                  "query": "SELECT SUM(revenue) AS [value], 0.12 AS trend FROM orders WHERE [month] = '2026-12'"
                },
                "props": {
                  "title": "Revenue this month",
                  "icon": "value",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": {
                    "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
                  }
                }
              }
            ]
          },
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "bind": {
                  "query": "SELECT SUM(orders) AS [value], -0.03 AS trend FROM orders WHERE [month] = '2026-12'"
                },
                "props": {
                  "title": "Orders this month",
                  "icon": "quantity",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": { "options": { "maximumFractionDigits": 0 } }
                }
              }
            ]
          },
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "bind": {
                  "query": "SELECT SUM(revenue) / SUM(orders) AS [value], 0 AS trend FROM orders"
                },
                "props": {
                  "title": "Average order",
                  "icon": "average",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": {
                    "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
                  }
                }
              }
            ]
          }
        ]
      },
      {
        "type": "RGrid",
        "props": { "cols": 3 },
        "items": [
          {
            "type": "RCard",
            "props": {
              "title": "Revenue by month",
              "classes": { "rootExtra": "relative h-72 col-span-2" }
            },
            "items": [
              {
                "type": "RECharts",
                "bind": {
                  "query": "SELECT [month], SUM(revenue) AS revenue FROM orders GROUP BY [month] ORDER BY [month]"
                },
                "props": {
                  "style": { "height": 230 },
                  "option": {
                    "grid": { "left": 48, "right": 8, "top": 16, "bottom": 24 },
                    "xAxis": { "show": true, "type": "category" },
                    "yAxis": { "show": true },
                    "tooltip": { "show": true, "trigger": "axis" },
                    "series": [
                      {
                        "type": "bar",
                        "encode": { "x": "month", "y": "revenue" },
                        "itemStyle": { "color": "#9a42ff" }
                      }
                    ]
                  }
                }
              }
            ]
          },
          {
            "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 %}

{% tab title="Code" %}
{% code title="getting-started/dashboard.tsx" %}

```tsx
import { Dashboard } from "@rierino-open/dv";
// the client from createClient(), set up in the Quick start
import { client } from "@/lib/rierino";

export default function StoreOverview() {
  return <Dashboard client={client} id="store-overview" />;
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
The example above runs on sample data in your browser, with a stand-in for the client, so it works without a server.
{% endhint %}

Several dashboards can be on the same page. Each one keeps its own data.

## Filter the data

`filter` values are sent with every source request as query parameters, where the sources' queries can use them. Changing a value reloads the data:

```tsx
const [region, setRegion] = useState('North');

<Dashboard client={client} id="store-overview" filter={{ region }} />;
```

See [Filters](https://docs.rierino.com/sdk-dv-ui/using-dashboard/dashboard.md#filters).

## Loading and errors

```tsx
<Dashboard
  client={client}
  id="store-overview"
  loading={<Spinner />}
  error={(e) => <p>Couldn't load the dashboard ({e.status}).</p>}
  onError={(e) => report(e.status, e.message)}
/>
```

`loading` and `error` cover the dashboard definition. `onError` is also called when one of the sources can't be loaded. Errors have a `status` (the HTTP status, or `"FETCH_ERROR"` when there was no response), a `message` and the response body as `data`. Failed requests are tried again up to 3 times, except for 4xx responses. See [Loading and errors](https://docs.rierino.com/sdk-dv-ui/using-dashboard/dashboard.md#loading-and-errors).

## Dashboard props

| Prop           | Type                                                              | Default                              | Description                                                                                                                                   |
| -------------- | ----------------------------------------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `client`       | `DashboardClient`                                                 |                                      | **Required.** Client from `createClient()` of `@rierino-open/api-client`; it sets the server and the authentication.                          |
| `id`           | `string`                                                          |                                      | **Required.** Id of the data visualization.                                                                                                   |
| `filter`       | `object`                                                          |                                      | Added to every source request as query parameters; changing it reloads the data.                                                              |
| `uiPath`       | `string`                                                          | `"request/crud/data_visualization/"` | Path the dashboard definition is read from, followed by the id.                                                                               |
| `sourcePath`   | `string`                                                          | `"request/ins_rpc/"`                 | Path the sources are read from, followed by each source's url.                                                                                |
| `allowScripts` | `boolean`                                                         | `false`                              | Runs code in the dashboard definition (ECharts tooltip `_formatter`). Off by default; turn it on only for dashboards from a server you trust. |
| `loading`      | `React.ReactNode`                                                 |                                      | Shown while the dashboard definition is loading.                                                                                              |
| `error`        | `((error: DashboardError) => React.ReactNode) \| React.ReactNode` |                                      | Shown when the dashboard definition can't be loaded.                                                                                          |
| `onError`      | `((error: DashboardError) => void)`                               |                                      | Called when the dashboard definition or one of its sources can't be loaded.                                                                   |

{% hint style="warning" %}
**Scripts are off by default**

A dashboard definition can contain code, such as ECharts tooltip formatters (`_formatter`). `Dashboard` doesn't run it unless `allowScripts` is set. Set it only for dashboards from a server you trust. See [Security](https://docs.rierino.com/sdk-dv-ui/using-dashboard/security.md), also for the Content Security Policy dashboards need.
{% endhint %}


---

# 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/getting-started/quick-start.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.
