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

# Styling

How a dashboard's styles and your page's styles work together, and which classes a definition can use.

The stylesheet you import once, `@rierino-open/dv/styles.css`, styles every dashboard on the page. Its rules only apply **inside dashboards**: each dashboard is wrapped in an element with the class `rie-dv`, and every rule is limited to it. That element takes no part in the layout (`display: contents`), so the dashboard is laid out as if it were a direct child of your element.

## What the dashboard takes from the page

* **Font, line height and text colour**: a dashboard inherits them from the element it's in, as text in your page does.
* **Width**: a dashboard is as wide as the element it's in. Put it in an element with the width you want.
* **Height**: it's as tall as its contents, which the definition sets, for example with a height class on each card.
* **Background**: a dashboard has none. Cards are white, and the space between them shows your page's background.

Charts, pivot tables and some built-in templates use the **Montserrat** font, which the stylesheet loads from Google Fonts. Where Google Fonts is blocked, they fall back to the browser's default font.

{% hint style="warning" %}
**Light pages only**

Dashboards have no dark mode: cards stay white, and text in them is dark. On a dark page, put the dashboard on a light area.
{% endhint %}

## Your page's styles inside a dashboard

The dashboard's styles stay inside it, but your page's styles can reach in. The dashboard's rules add no weight to their selectors, so a rule of your page that matches an element inside a dashboard wins over them. Here the page's rules for buttons and table cells also change the dashboard's table:

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

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": {
    "type": "RTable",
    "bind": {
      "query": "SELECT city, region, SUM(orders) AS orders FROM orders GROUP BY city, region ORDER BY orders DESC"
    },
    "props": { "columns": [{ "header": "City" }, { "header": "Region" }, { "header": "Orders" }] }
  }
}
```

{% 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="dashboard/styled-page.tsx" %}

```tsx
import { Dashboard } from "@rierino-open/dv";
import { client } from "@/lib/rierino";

// the page's own stylesheet: its rules for buttons and cells reach into the dashboard's table too
const pageStyles = `
  .host-page { font-family: Georgia, serif; }
  .host-page h2 { font-size: 22px; margin: 0 0 12px; color: #7a1f1f; }
  .host-page button { padding: 6px 14px; border: 2px solid #7a1f1f; border-radius: 6px; background: #fbeaea; }
  .host-page td { border-bottom: 1px dashed #7a1f1f; }
`;

export default function StyledPage() {
  return (
    <div className="host-page">
      <style>{pageStyles}</style>
      <h2>The page's heading</h2>
      <button>The page's button</button>
      <div style={{ marginTop: 16 }}>
        <Dashboard client={client} id="orders-table" />
      </div>
    </div>
  );
}
```

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

Charts are drawn as SVG and aren't affected, but tables and pivot tables use buttons, inputs, selects and table cells, like your page does. To keep a rule out of dashboards, add `:not(.rie-dv *)` to its selector:

```css
.host-page button:not(.rie-dv *) { … }
.host-page td:not(.rie-dv *) { … }
```

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

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": {
    "type": "RTable",
    "bind": {
      "query": "SELECT city, region, SUM(orders) AS orders FROM orders GROUP BY city, region ORDER BY orders DESC"
    },
    "props": { "columns": [{ "header": "City" }, { "header": "Region" }, { "header": "Orders" }] }
  }
}
```

{% 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="dashboard/styled-page-fixed.tsx" %}

```tsx
import { Dashboard } from "@rierino-open/dv";
import { client } from "@/lib/rierino";

// the page's own stylesheet: `:not(.rie-dv *)` keeps its rules for buttons and cells out of the dashboard
const pageStyles = `
  .host-page { font-family: Georgia, serif; }
  .host-page h2 { font-size: 22px; margin: 0 0 12px; color: #7a1f1f; }
  .host-page button:not(.rie-dv *) { padding: 6px 14px; border: 2px solid #7a1f1f; border-radius: 6px; background: #fbeaea; }
  .host-page td:not(.rie-dv *) { border-bottom: 1px dashed #7a1f1f; }
`;

export default function StyledPageFixed() {
  return (
    <div className="host-page">
      <style>{pageStyles}</style>
      <h2>The page's heading</h2>
      <button>The page's button</button>
      <div style={{ marginTop: 16 }}>
        <Dashboard client={client} id="orders-table" />
      </div>
    </div>
  );
}
```

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

## Classes in definitions

Each component has named parts, such as `root` and `title` on a [Card](https://docs.rierino.com/sdk-dv-ui/layout/card.md), listed under **Classes** on its page. Its `classes` prop sets their class names, two ways:

| Key           | What it does                         |
| ------------- | ------------------------------------ |
| `<part>`      | Replaces the part's built-in classes |
| `<part>Extra` | Adds classes to the built-in ones    |

```json
{ "type": "RCard", "props": { "classes": { "rootExtra": "relative h-72", "title": "text-bold-12" } } }
```

The built-in classes are [Tailwind CSS v3](https://v3.tailwindcss.com/docs) classes. A class name in a definition only works if a stylesheet on the page defines it.

### Classes in the dashboard stylesheet

The stylesheet has the classes the components use, and these sets in full:

| Classes                                                                        | Examples                                            |
| ------------------------------------------------------------------------------ | --------------------------------------------------- |
| Grid columns and rows, 1 to 8                                                  | `grid-cols-3`, `col-span-2`, `row-span-full`        |
| Flex grow                                                                      | `grow`, `grow-2`                                    |
| Margins                                                                        | `m-4`, `mx-auto`, `mt-2`, `-mb-1`                   |
| Heights in Tailwind's scale                                                    | `h-20`, `h-72`                                      |
| The [Rierino colours](#rierino-colours) as text, background, border and stroke | `text-heliotrope`, `bg-titan-white`, `border-coral` |
| The [Rierino font sizes](#rierino-font-sizes)                                  | `text-bold-14`, `text-regular-12`                   |

Other Tailwind classes are in only if a component uses them, so similar classes can differ: `px-4` and `gap-x-4` are in, `p-4` and `gap-4` aren't. To check a class, search the stylesheet for it, with `.` in front and `{` after:

```bash
grep -c '\.p-4{' node_modules/@rierino-open/dv/dist/styles.css
```

`0` means the class isn't there. Classes that aren't there change nothing, without an error.

### Rierino colours

Use them as `text-<name>`, `bg-<name>`, `border-<name>` or `stroke-<name>`.

<details>

<summary>Colour names</summary>

| Name              | Colour    | Name             | Colour    |
| ----------------- | --------- | ---------------- | --------- |
| `tolopea`         | `#1b064c` | `hawkes-blue`    | `#dfebfb` |
| `paris-m`         | `#20075a` | `bright-gray`    | `#363b4a` |
| `persian-blue`    | `#261fad` | `comet`          | `#515a70` |
| `electric-violet` | `#6022f1` | `lynch`          | `#6b7794` |
| `purple-heart`    | `#6c3bde` | `manatee`        | `#8f97ae` |
| `heliotrope`      | `#9a42ff` | `mischka`        | `#d3d6df` |
| `indigo`          | `#5f59cf` | `athens-gray`    | `#edeff2` |
| `portage`         | `#847ef6` | `mandy`          | `#eb475a` |
| `perfume`         | `#ada9f9` | `pink`           | `#ffbdc4` |
| `pigeon-post`     | `#b7b5de` | `azalea`         | `#fbdfe2` |
| `moon-raker`      | `#d8cbf6` | `coral`          | `#ff7e47` |
| `fog`             | `#ead6ff` | `romantic`       | `#ffd4c2` |
| `selago`          | `#e9e8fc` | `peach-schnapps` | `#ffe6db` |
| `titan-white`     | `#f0f0ff` | `forget-me-not`  | `#fff1eb` |
| `blue-chalk`      | `#f4f0ff` | `eucalyptus`     | `#259374` |
| `magnolia`        | `#fbfaff` | `munsell`        | `#02bc77` |
| `azure`           | `#366dba` | `shamrock`       | `#33cca1` |
| `periwinkle`      | `#bdd8ff` | `polar`          | `#e2f8f2` |

Also `white`, `black`, and the basic colours `amber`, `blue`, `brown`, `cyan`, `gray`, `green`, `lime`, `mint`, `orange`, `purple`, `red`, `tangerine`, `teal`, `violet` and `yellow`, which replace Tailwind's colours of the same names: `text-blue` is a single blue, and `text-blue-500` isn't in the stylesheet.

</details>

### Rierino font sizes

Use them as `text-<name>`. Each sets the size, line height and weight.

<details>

<summary>Font size names</summary>

| Name                                       | Size / line height            | Weight |
| ------------------------------------------ | ----------------------------- | ------ |
| `bold-10`, `bold-12`, `bold-13`, `bold-14` | 10/13, 12/15, 13/17, 14/18 px | 700    |
| `bold-22`, `bold-24`, `bold-28`            | 22/28, 24/30, 28/35 px        | 700    |
| `semibold-8`, `semibold-12`                | 8/10, 12/15 px                | 600    |
| `medium-8`, `medium-10`, `medium-12`       | 8/10, 10/13, 12/15 px         | 500    |
| `medium-11`                                | 11/14 px                      | 600    |
| `medium-zip-11`                            | 11/20 px                      | 500    |
| `regular-10`, `regular-11`, `regular-12`   | 10/12, 11/20, 12/15 px        | 500    |
| `regular-14`, `regular-16`, `regular-22`   | 14/18, 16/20, 22/28 px        | 500    |

</details>


---

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