# Icon

> One of Rost's 23 glyphs, 24px, in the colour of the text around it.

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

## Install

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

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

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 |
|---|---|---|---|
| `name` | enum | `arrow-down` `arrow-down-left` `arrow-left` `arrow-right` `arrow-up` `chevron-down` `chevron-left` `chevron-right` `chevron-up` `circle-outline` `desktop` `dot` `down-right` `drag` `lock` `minus` `mobile` `plus` `scroll` `search` `star` `up-left` `up-right` | `arrow-right` |
| `size` | enum | `Medium` `Small` `XSmall` | `Medium` |
| `label` | slot |  |  |

## Anatomy

- `root`: A `<span>` filled with `currentColor` and cut to the icon's shape by a mask, so one file draws in any colour and follows a button's states.

## When to use

- **Next to a label.** Next to a label, when the shape says the same thing faster. An arrow on "Back", a chevron on something that opens.
- **Inside a button.** Inside Button and IconButton, through their `icon` slot, at Small.

## When not to use

- **Something to press.** On its own as something to press. That's **IconButton**, which gives it a target and states.
- **A picture with no job.** A picture with no job next to words. That's an **Illustration**, which keeps its own colours.
- **A glyph Rost lacks.** A glyph Rost doesn't have. Add the SVG to `assets/icons/` and Figma's set first, so they stay the same list.

## Behaviour

It takes the text colour it sits in. Figma draws them in `non-interactive/foreground/tertiary` (#999999); inside a Button it's the button's icon colour, state by state. The shapes are Figma's exports, kept as they are.

## Accessibility

- **Hidden**: Next to words that say the same, it's `aria-hidden="true"`. That's the default.
- **Labelled**: On its own and meaningful, pass `label`. It becomes `role="img"` with that `aria-label`.

## Content

A label names what it means, not what it looks like. "Next", not "Right arrow".

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `spacing/size/2xsmall` | `16px` |
| `spacing/size/small` | `24px` |
| `spacing/size/xsmall` | `20px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `root` | `mask-image` | `url(./svg/arrow-down.svg)` | The icon file, `assets/icons/arrow-down.svg`. |
| `root` | `mask-image` | `url(./svg/arrow-down-left.svg)` | The icon file, `assets/icons/arrow-down-left.svg`. |
| `root` | `mask-image` | `url(./svg/arrow-left.svg)` | The icon file, `assets/icons/arrow-left.svg`. |
| `root` | `mask-image` | `url(./svg/arrow-right.svg)` | The icon file, `assets/icons/arrow-right.svg`. |
| `root` | `mask-image` | `url(./svg/arrow-up.svg)` | The icon file, `assets/icons/arrow-up.svg`. |
| `root` | `mask-image` | `url(./svg/chevron-down.svg)` | The icon file, `assets/icons/chevron-down.svg`. |
| `root` | `mask-image` | `url(./svg/chevron-left.svg)` | The icon file, `assets/icons/chevron-left.svg`. |
| `root` | `mask-image` | `url(./svg/chevron-right.svg)` | The icon file, `assets/icons/chevron-right.svg`. |
| `root` | `mask-image` | `url(./svg/chevron-up.svg)` | The icon file, `assets/icons/chevron-up.svg`. |
| `root` | `mask-image` | `url(./svg/circle-outline.svg)` | The icon file, `assets/icons/circle-outline.svg`. |
| `root` | `mask-image` | `url(./svg/desktop.svg)` | The icon file, `assets/icons/desktop.svg`. |
| `root` | `mask-image` | `url(./svg/dot.svg)` | The icon file, `assets/icons/dot.svg`. |
| `root` | `mask-image` | `url(./svg/down-right.svg)` | The icon file, `assets/icons/down-right.svg`. |
| `root` | `mask-image` | `url(./svg/drag.svg)` | The icon file, `assets/icons/drag.svg`. |
| `root` | `mask-image` | `url(./svg/lock.svg)` | The icon file, `assets/icons/lock.svg`. |
| `root` | `mask-image` | `url(./svg/minus.svg)` | The icon file, `assets/icons/minus.svg`. |
| `root` | `mask-image` | `url(./svg/mobile.svg)` | The icon file, `assets/icons/mobile.svg`. |
| `root` | `mask-image` | `url(./svg/plus.svg)` | The icon file, `assets/icons/plus.svg`. |
| `root` | `mask-image` | `url(./svg/scroll.svg)` | The icon file, `assets/icons/scroll.svg`. |
| `root` | `mask-image` | `url(./svg/search.svg)` | The icon file, `assets/icons/search.svg`. |
| `root` | `mask-image` | `url(./svg/star.svg)` | The icon file, `assets/icons/star.svg`. |
| `root` | `mask-image` | `url(./svg/up-left.svg)` | The icon file, `assets/icons/up-left.svg`. |
| `root` | `mask-image` | `url(./svg/up-right.svg)` | The icon file, `assets/icons/up-right.svg`. |

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