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

# Installation

Add the dashboard renderer to your own React app.

{% hint style="info" %}
Only needed outside Rierino. Dashboards and DV widgets inside the Rierino admin UI work without installing anything, see [Dashboards in Rierino](https://docs.rierino.com/sdk-dv-ui/getting-started/in-rierino.md).
{% endhint %}

## Requirements

* **React 18.** React 19 isn't supported yet.
* **A Rierino server** your users' browsers can reach. Dashboards load their definition and data in the browser, so the gateway has to accept requests from your app's origin (see [CORS settings](https://docs.rierino.com/devops/api-gateway-and-security/gateway-servers)).
* **A way to sign requests**, such as a gateway token for the user. `@rierino-open/api-client` adds it to every request the dashboard makes.

## Install

{% stepper %}
{% step %}

### Point npm at GitHub Packages

The packages are published to GitHub Packages under `@rierino-open`. Add this to the `.npmrc` of your project; the token needs the `read:packages` scope:

{% code title=".npmrc" %}

```ini
@rierino-open:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
```

{% endcode %}
{% endstep %}

{% step %}

### Add the packages

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

```bash
npm install @rierino-open/dv @rierino-open/api-client
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @rierino-open/dv @rierino-open/api-client
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @rierino-open/dv @rierino-open/api-client
```

{% endtab %}

{% tab title="bun" %}

```bash
bun add @rierino-open/dv @rierino-open/api-client
```

{% endtab %}
{% endtabs %}

The chart libraries (ECharts, Plotly and the pivot table) come with the package. Plotly is loaded only when a dashboard uses it.
{% endstep %}

{% step %}

### Load the stylesheet

Import it once, for example in your app's entry file:

```tsx
import '@rierino-open/dv/styles.css';
```

Its rules apply only inside dashboards, so the rest of your page keeps its own styles. A dashboard takes the font and line height of the page around it. The stylesheet also loads the Montserrat font from Google Fonts, which the built-in templates use.
{% endstep %}
{% endstepper %}

## Next.js

Dashboards need React 18. The Next.js routers that run on React 18 are:

| Next.js   | App Router                     | Pages Router                                                |
| --------- | ------------------------------ | ----------------------------------------------------------- |
| 14        | Yes                            | Yes                                                         |
| 15 and 16 | No: it always runs on React 19 | Yes, with `react` and `react-dom` 18 in your `package.json` |

A dashboard loads its definition and data in the browser. On the server, it renders only its `loading` content, or nothing, and makes no requests, so the package can be imported on the server without `next/dynamic`.

{% tabs %}
{% tab title="App Router" %}
`<Dashboard>` uses React state, so render it in a client component. Import the client there too: it can't be passed from a server component.

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

```tsx
'use client';

import { Dashboard } from '@rierino-open/dv';
import { client } from '@/lib/rierino';

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

{% endcode %}

Import the stylesheet once, in the root layout:

{% code title="app/layout.tsx" %}

```tsx
import '@rierino-open/dv/styles.css';
```

{% endcode %}
{% endtab %}

{% tab title="Pages Router" %}
Import the stylesheet in `_app`. Pages need no `'use client'`.

{% code title="pages/\_app.tsx" %}

```tsx
import type { AppProps } from 'next/app';
import '@rierino-open/dv/styles.css';

export default function App({ Component, pageProps }: AppProps) {
  return <Component {...pageProps} />;
}
```

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

Next, [show your first dashboard](https://docs.rierino.com/sdk-dv-ui/getting-started/quick-start.md).


---

# 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/installation.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.
