# Card

> A plate that holds one thing together, like a summary, a setting or a figure. Filled grey, or just an edge.

| | |
|---|---|
| Kind | component |
| Contract | `review` · [card.contract.yaml](https://github.com/Runceanu/rost/blob/master/contracts/card.contract.yaml) |
| Guidance | `proposed` |
| Source | [Figma 733:152](https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=733-152) · read 2026-11-16 · frozen 2026-11-16 |
| Implemented in | nowhere yet |

## Install

It lands in `src/rost/card/`, with what it needs and its contract:

```sh
npx github:Runceanu/rost add card
```

Then import `src/rost/fonts.css` and `src/rost/tokens.css` once, at the root of the app. More on this in [Install](https://rost.build/docs/install.md).

## Props

| Prop | Type | Values | Default |
|---|---|---|---|
| `tone` | enum | `filled` `outlined` | `filled` |
| `children` | slot |  |  |

## Anatomy

- `root`: A `<div>`, or a `<section>` with `as` when it has a heading of its own. It lays its children out in a column, 16px apart.

## When to use

- **Things that belong together.** A month's totals, one setting with its explanation, a client's details: one card each.
- **On grey.** Inside a panel that's grey already, `outlined` keeps the edge without stacking grey on grey.

## When not to use

- **Something to click.** A whole card that's a link. That's **Thumbs**, which has hover, press and focus.
- **Rows of data.** Rows you compare. That's **Table**.
- **Cards in cards.** One card inside another. Use spacing and a heading instead.

## Behaviour

A plate with 24px inside it and 16px between what it holds. It doesn't do anything: no hover, no press. The edge on `outlined` is decoration, so it doesn't need 3:1 against the page; what's in the card has to carry itself.

## Accessibility

- **Element**: A `<div>` by default. Make it a `<section>` with an `aria-labelledby` pointing at its heading when it's a part of the page someone would jump to.
- **Colour**: The filled plate is #171717 on the dark page. Text on it uses the same tokens as on the page and keeps AA.

## Content

A heading, if it needs one, in sentence case. Keep it to one idea.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `card/filled/background` | `#171717` |
| `card/outlined/edge` | `#3a3a3a` |
| `spacing/gap/large` | `24px` |
| `spacing/gap/medium` | `16px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/large` | `16px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside the card. |

See it live, with every value of every variant: [rost.build/components/card/](https://rost.build/components/card/)
