> A guide to [@fabiocv/ui](https://ui.fabio.cv/). Every guide is listed at https://ui.fabio.cv/llms.txt.

# Typography

One family, one size, and smaller ones inside menus and tooltips. Code has a family of its own.

## Rules

- Every piece of text is Geist 16px on a 24px line, apart from menus, small buttons, small toggles, badges, tooltips and code: menu items, small buttons, small toggles and tooltips at 14px on a 20px line, group labels, tab labels and badges at 12px on a 16px line, and code in Geist Mono 14px on the 24px line.
- Make hierarchy with weight and ink. Never with a second family, and never with size outside menus, small buttons, small toggles, badges and tooltips. Geist Mono is for code only.
- Use Medium for names, section headings, menu group labels and badges, the only emphasis. Use Regular for everything else.
- Use `Text.Body.Regular` and `Text.Body.Medium` instead of setting font properties one by one. Use `Text.Menu.Regular` for menu items, small buttons, small toggles and tooltips, `Text.GroupLabel.Medium` for menu group labels and badges, and `Text.Code.Regular` for code.
- `FontWeights.Regular` and `FontWeights.Medium` are CSS variables, so the inspector shows the token.
- The other `Text` roles (`Heading`, `BodySmall`, `Label`, `Caption`, `Micro`) and `FontWeights.Semibold` are for dense data UI: tables, charts and tags. A page does not use them.
- `Text` is a style object for Vanilla Extract, and works as a React `style`. Figures are tabular, on `body` and in every role at `16px` and in dense data, which keeps columns of numbers from jittering as digits change.

The exceptions are `ImageCard`, whose tag is 10px and title 12px, set into a picture, and `FlipName`, which is a mark and takes any size.

## Roles

| Role             | Weight  | Ink                                                | Where       |
| ---------------- | ------- | -------------------------------------------------- | ----------- |
| Name, page title | Medium  | Foreground                                         | Any page    |
| Body             | Regular | Foreground secondary                               | Any page    |
| Section heading  | Medium  | Foreground muted                                   | Any page    |
| Date             | Regular | Foreground muted                                   | Any page    |
| Hovered date     | Regular | Foreground secondary                               | Any page    |
| Menu item        | Regular | Foreground secondary                               | `Menu`      |
| Menu group label | Medium  | Foreground muted                                   | `Menu`      |
| Toggle           | Regular | Foreground secondary, and Foreground while hovered | `Toggle`    |
| Tooltip          | Regular | Surface, on Foreground muted                       | `Tooltip`   |
| Badge            | Medium  | The ink of the text it marks                       | `Badge`     |
| Code             | Regular | `CodeColors`, on Surface sunken                    | Code blocks |
| Headline         | Regular | Foreground muted                                   | fabio.cv    |
| Trail            | Regular | Foreground muted, after the name                   | fabio.cv    |
| Writing title    | Regular | Foreground secondary                               | fabio.cv    |

| Tab label | Regular | Foreground muted | fabio.cv |

## Tokens

| Token                   | Value          | Code                     | Use for                                                        |
| ----------------------- | -------------- | ------------------------ | -------------------------------------------------------------- |
| `--font-sans`           | `"Geist"`      | `Fonts.Sans`             | All text but code                                              |
| `--font-mono`           | `"Geist Mono"` | `Fonts.Mono`             | Code                                                           |
| `--text-body`           | `16px`         | `Text.Body`              | All text                                                       |
| `--leading-body`        | `24px`         | `Text.Body`, `Text.Code` | One line of text is one row, code included                     |
| `--text-menu`           | `14px`         | `Text.Menu`, `Text.Code` | Menu items, small buttons, small toggles, tooltips and code    |
| `--leading-menu`        | `20px`         | `Text.Menu`              | One line of a menu item, small button, small toggle or tooltip |
| `--text-label`          | `12px`         | `Text.GroupLabel`        | Menu group labels, tab labels and badges                       |
| `--leading-label`       | `16px`         | `Text.GroupLabel`        | One line of a menu group label, tab label or badge             |
| `--font-weight-regular` | `400`          | `FontWeights.Regular`    | Body, metadata, dates, links                                   |
| `--font-weight-medium`  | `500`          | `FontWeights.Medium`     | Names, section headings, menu group labels and badges          |

See it at https://ui.fabio.cv/typography/.
