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

# Card

Frames a component on a white card, with an optional title, subtitle and info tooltip.

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

```json
{
  "sources": [],
  "layout": {
    "type": "RGrid",
    "props": { "cols": 2 },
    "items": [
      {
        "type": "RCard",
        "props": {
          "title": "Top cities",
          "subtitle": "Last 6 months",
          "description": "Revenue of paid orders, by the city they ship to",
          "classes": { "rootExtra": "relative h-44" }
        },
        "items": [
          {
            "type": "RList",
            "props": {
              "icon": "●",
              "valueFormat": {
                "options": { "style": "currency", "currency": "USD", "maximumFractionDigits": 0 }
              },
              "sample": [
                { "name": "Austin", "value": 30489 },
                { "name": "Denver", "value": 30213 },
                { "name": "Chicago", "value": 29427 }
              ]
            }
          }
        ]
      },
      {
        "type": "RCol",
        "items": [
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "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 }
                  },
                  "sample": { "value": 27445, "trend": 0.12 }
                }
              }
            ]
          },
          {
            "type": "RCard",
            "props": { "classes": { "rootExtra": "relative h-20" } },
            "items": [
              {
                "type": "RIconStat",
                "props": {
                  "title": "Orders this month",
                  "icon": "quantity",
                  "classes": { "rootExtra": "h-full items-center", "left": "px-2 mr-2" },
                  "valueFormat": { "options": { "maximumFractionDigits": 0 } },
                  "sample": { "value": 280, "trend": -0.03 }
                }
              }
            ]
          }
        ]
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

## Usage

```json
{
  "type": "RCard",
  "props": {
    "title": "Top cities",
    "subtitle": "Last 6 months",
    "description": "Revenue of paid orders, by the city they ship to",
    "classes": { "rootExtra": "relative h-44" }
  },
  "items": [{ "type": "RList", "props": { "nameField": "city", "valueField": "revenue" } }]
}
```

`description` adds an info icon in the corner that shows it as a tooltip.

Give a card a title when its contents have none, such as a list or a chart. Components with a title of their own, such as an Icon Stat, go on a card without one, as on the right of the example above.

{% hint style="warning" %}
**Give cards a height**

A card places its items inside its own area instead of growing around them, so a card without a height collapses. Set one with an `h-<n>` class in `classes.rootExtra`, together with `relative`: about `h-20` for a stat, `h-44` for a short list and `h-72` for a chart.
{% endhint %}

## Props

| Prop          | Type     | Default | Description                                                  |
| ------------- | -------- | ------- | ------------------------------------------------------------ |
| `title`       | `string` |         | Title at the top of the card.                                |
| `subtitle`    | `string` |         | Smaller text under the title.                                |
| `description` | `string` |         | Shown in a tooltip of the info icon in the top right corner. |
| `classes`     | `object` |         | Class names for the card's parts, see Classes below.         |

In the Rierino designer: **Title**, **Subtitle**, **Description** and **Classes**.

## Classes

| Part       | Built-in classes                                                                  | Styles                             |
| ---------- | --------------------------------------------------------------------------------- | ---------------------------------- |
| `root`     | `bg-white border-hawkes-blue box-border … rounded-lg border-[1.5px] border-solid` | The card                           |
| `header`   | `m-2.5`                                                                           | The area of the title and subtitle |
| `title`    | `flex items-center text-bright-gray text-bold-14`                                 | The title                          |
| `subtitle` | none                                                                              | The subtitle                       |

Set `classes.<part>` to replace the built-in classes, or `classes.<part>Extra` to add to them. Use `rootExtra` for the height and for the card's place in a [Grid](https://docs.rierino.com/sdk-dv-ui/layout/grid.md), such as `col-span-2`.


---

# 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/layout/card.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.
