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

# Label

Shows a line of text with a smaller line under it, fixed or from data.

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

```json
{
  "sources": [{ "key": "orders", "url": "SourceVisData?queryId=orders", "params": {} }],
  "layout": {
    "type": "RGrid",
    "props": { "cols": 3 },
    "items": [
      {
        "type": "RLabel",
        "props": { "label": "Store overview", "sublabel": "Updated hourly" }
      },
      {
        "type": "RLabel",
        "bind": { "query": "SELECT city, region FROM orders ORDER BY revenue DESC LIMIT 1" },
        "props": { "labelField": "city", "sublabelField": "region" }
      },
      {
        "type": "RLabel",
        "bind": { "query": "SELECT COUNT(DISTINCT city) AS cities FROM orders" },
        "props": { "label": "Cities", "sublabelField": "cities" }
      }
    ]
  }
}
```

{% 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": "RLabel",
  "bind": { "query": "SELECT city, region FROM orders ORDER BY revenue DESC LIMIT 1" },
  "props": { "labelField": "city", "sublabelField": "region" }
}
```

Each line is either fixed text (`label`, `sublabel`) or a field of the first row of the data (`labelField`, `sublabelField`). Fixed text wins when both are set.

Inside a [Loop](https://docs.rierino.com/sdk-dv-ui/layout/loop.md), a label without a query of its own shows its copy's first row, which makes it a good heading for each group.

## Props

| Prop            | Type     | Default                                    | Description                                     |
| --------------- | -------- | ------------------------------------------ | ----------------------------------------------- |
| `label`         | `string` |                                            | Fixed text of the first line.                   |
| `sublabel`      | `string` |                                            | Fixed text of the second line.                  |
| `labelField`    | `string` | `"label"`                                  | Field the first line is read from.              |
| `sublabelField` | `string` | `"sublabel"`                               | Field the second line is read from.             |
| `sample`        | `object` | `{ label: "Label", sublabel: "Sublabel" }` | Row shown when there is no data, for designing. |
| `classes`       | `object` |                                            | Class names for the parts, see Classes below.   |

In the Rierino designer: **Label**, **Sublabel**, **Label Field**, **Sublabel Field** and **Classes**.

## Classes

| Part       | Built-in classes                                                    | Styles          |
| ---------- | ------------------------------------------------------------------- | --------------- |
| `root`     | `self-center overflow-hidden`                                       | The label       |
| `label`    | `overflow-hidden whitespace-nowrap text-paris-m … text-[0.9375rem]` | The first line  |
| `sublabel` | `opacity-100 overflow-hidden text-medium-11 text-[0.8125rem] …`     | The second line |

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/label.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.
