# Typography

Type sets for titles, body text, values, and code.

## Overview

Type in Tempo is quiet and direct. Inter carries the interface and its numbers, Pilat gives titles their character, and JetBrains Mono keeps addresses and code legible.

Each set bundles a family, size, weight, line height, and tracking into one token, so you choose a role instead of tuning properties. A set keeps one size at every screen width.

```tsx
import { style } from '@tempoxyz/ds'

namespace styles {
  export const title = style({ typography: 'heading.h2' })

  export const body = style({ color: 'content.secondary', typography: 'body.b2' })
}
```

## Typefaces

Three bundled families cover every set.

* **Inter (100 to 900):** Body text, labels, buttons, table cells, and numbers.
* **Pilat (100 to 900):** Page, dialog, section, card, and hero titles only.
* **JetBrains Mono (400 to 700):** Addresses, hashes, keys, and code.

## Type Sets

Six sets cover the interface, from hero titles down to small labels.

### Display

Hero titles in Pilat, in light and regular weights that let size carry the emphasis.

* `display.d1`: Pilat, 44px, weight 300, line height 41.8px
* `display.d2`: Pilat, 36px, weight 400, line height 34.2px

### Value

Large readings in Inter, such as a balance, with tight tracking so the digits read as one figure.

* `value.v1`: Inter, 80px, weight 400, line height normal
* `value.v2`: Inter, 52px, weight 400, line height normal
* `value.v3`: Inter, 40px, weight 400, line height normal

### Heading

Page, dialog, section, and card titles, in Pilat at a medium weight. Only the heading and display sets use Pilat. Tracking tightens as the size grows, so large titles stay compact.

* `heading.h1`: Pilat, 32px, weight 500, line height 36.8px
* `heading.h2`: Pilat, 24px, weight 500, line height 27.6px
* `heading.h3`: Pilat, 20px, weight 500, line height 23px
* `heading.h4`: Pilat, 18px, weight 500, line height 20.7px

### Body

Paragraphs, descriptions, labels, buttons, and table cells, in a regular and a strong weight at each size.

* `body.b1`: Inter, 16px, weight 400, line height 22px
* `body.b1Strong`: Inter, 16px, weight 500, line height 22px
* `body.b2`: Inter, 14px, weight 400, line height 20px
* `body.b2Strong`: Inter, 14px, weight 500, line height 20px
* `body.b3`: Inter, 12px, weight 400, line height 16px
* `body.b3Strong`: Inter, 12px, weight 500, line height 16px

* **Weight (400 and 500):** Strong sets add emphasis without a larger size.
* **Default (body.b1):** The page default, a size down on dense screens.
* **Inputs (body.b1):** Large fields keep 16px, so iOS Safari won't zoom.
* **Buttons (body.b2Strong):** Buttons set their own labels, one size per button.

### Mono

Addresses, hashes, keys, and code, in one size.

* **Addresses and Hashes (mono.m1):** Hex values and monospace table cells.
* **Commands and Keys (mono.m1):** Snippets and secret values.

### Utility

Short metadata labels in the mono family, with wide tracking. The design sets them in uppercase, which a component applies itself, since the sets keep the text's case.

* `utility.m1`: JetBrains Mono, 12px, weight 400, line height 16px
* `utility.m2`: JetBrains Mono, 10px, weight 400, line height 12px

* **Label (utility.m1):** Metadata labels above or beside a value.
* **Small Label (utility.m2):** The smaller size, for labels in tight spaces.

## Guidelines

### Build Hierarchy With Few Sizes

Build hierarchy with size and weight, not color. Most screens need a page title, section titles, and body text.

* **Page Title (heading.h2):** One per page, including app shell and dialog titles.
* **Section and Card Title (heading.h3):** Section, surface, and popover titles.
* **Small Title (body.b1Strong):** Compact titles, such as empty states and legends.
* **Body and Secondary Text (body.b1):** Reading text, in the primary or secondary color.

Keep headings in order. Choose the element by its place in the outline and the set by its look.

**Do:** Let the component set the label and description sizes.

```tsx
<Field.Root>
  <Field.Label>Amount</Field.Label>
  <TextInput.Group>
    <TextInput.Control defaultValue="25.00" />
  </TextInput.Group>
  <Field.Description>Available balance: 120.00 USDC.</Field.Description>
</Field.Root>
```

**Don't:** Use all caps or bold every line to create hierarchy. Write in [sentence case](/docs/foundations/content/writing-style#capitalization).

```tsx
<p>
  <strong>AMOUNT</strong>
</p>
<p>
  <strong>Available balance: 120.00 USDC.</strong>
</p>
```

### Match Sets to Their Role

* **Wrapping Text (body):** Anything that can wrap.
* **Labels (body.b2Strong):** Field labels and short lines beside controls.
* **Titles (heading):** Page, dialog, section, and card titles.
* **Hero Numbers (value):** One balance or reading per screen, in Inter.

### Reserve Pilat for Titles

Pilat sets titles only: page, dialog, section, and card titles in the heading sets, and hero titles in the display sets, from 18px up. Inter sets everything else, including labels, tabs, toasts, buttons, and numbers.

**Do:** Set the title in Pilat and the text below it in Inter.

```tsx
<Surface.Title>Recent payments</Surface.Title>
<TypeDemo kind="body" />
```

**Don't:** Set Pilat on labels, tabs, toasts, or numbers, or below 18px.

```tsx
<Snippet size="small">{"fontFamily: 'heading'"}</Snippet>
```

### Use Five Styles per Screen

Dense screens, such as consoles and internal tools, use at most five styles. Add `mono.m1` as a sixth only where the screen shows hex values or code.

* **Page Title (heading.h2):** One per screen, in Pilat.
* **Section Title (heading.h3):** Sections, cards, and dialogs, in Pilat.
* **Body (body.b2):** Text, table cells, and descriptions.
* **Strong (body.b2Strong):** Labels, buttons, and emphasis.
* **Meta (body.b3):** Timestamps, hints, and secondary details.
* **Hex and Code (mono.m1):** The sixth style, only for hex values and code.

* **Families (2 per screen):** Inter and Pilat, plus mono only for hex and code.
* **Content Sizes (3 per screen):** Below the titles, use weight and color before size.

### Let Components Set Their Type

Components set the type of their own parts, such as a field label, a table cell, or a button. Pass text as children, and don't restyle it.

* **Component Text (children):** Pass plain text. The component applies its set and color.
* **Your Own Text (typography):** Choose a set by role, from the five styles above.

### Set Type With One Set

Set your own text with one `typography` set. Don't combine a family, size, or weight from different sets, which renders a style that the designs don't define. The [Linter](/docs/foundations/linter#set-type-with-a-typography-set) reports these.

**Do:** Set the role as one set.

```tsx
<Snippet size="small" style={{ width: 240 }}>
  {"typography: 'body.b2'"}
</Snippet>
```

**Don't:** Build or adjust a style with separate type properties.

```tsx
<Snippet size="small" style={{ width: 240 }}>
  {"fontWeight: '600 !custom'"}
</Snippet>
```

### Reserve the Expressive Sets

* **Display (display):** One hero title per screen, in Pilat. Never in cards, tables, or dialogs.
* **Value (value):** One headline reading per screen, in Inter. Not for a row of metrics.
* **Utility (utility):** A metadata label above a value. No other text uses all caps.
* **Mono (mono):** Hex values and code only. Not for numbers, amounts, dates, or labels.

### Use Tabular Figures for Numbers

Tabular figures align digits in columns and keep live values from shifting. [Amount](/docs/components/amount), [NumberField](/docs/components/number-field), [Slider](/docs/components/slider), and numeric table cells already set them.

**Do:** Align amounts with tabular figures, such as `Amount` with `align="right"`.

```tsx
/**
 * Do example for "Use Tabular Figures for Numbers" on the Typography page.
 * Align amounts with tabular figures, such as `Amount` with `align="right"`.
 * @module
 */
import { Amount, style } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.column()}>
      <Amount align="right" symbol="PathUSD" value="1111.11" />
      <Amount align="right" symbol="PathUSD" value="8808.80" />
      <Amount align="right" symbol="PathUSD" value="4170.25" />
    </div>
  )
}

namespace styles {
  export const column = style({ display: 'grid', gap: '8', width: '12rem !custom' })
}
```

**Don't:** Stack amounts in proportional figures, where digits drift out of line.

```tsx
/**
 * Don't example for "Use Tabular Figures for Numbers" on the Typography page.
 * Don't stack amounts in proportional figures, where digits drift out of line.
 * @module
 */
import { style } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.column()}>
      <span {...styles.amount()}>1,111.11 PathUSD</span>
      <span {...styles.amount()}>8,808.80 PathUSD</span>
      <span {...styles.amount()}>4,170.25 PathUSD</span>
    </div>
  )
}

namespace styles {
  export const amount = style({
    color: 'content.primary',
    fontVariantNumeric: 'proportional-nums !custom',
    textAlign: 'right',
    typography: 'body.b2Strong',
  })

  export const column = style({ display: 'grid', gap: '8', width: '12rem !custom' })
}
```

If you render a number yourself, such as a metric tile, set tabular figures in its style.

```tsx
style({ fontVariantNumeric: 'tabular-nums !custom' })
```

### Use Monospace for Hashes and Code

Set addresses, hashes, keys, and code in monospace, so similar characters stay distinct and equal-length values align. [Hex](/docs/components/hex), [Snippet](/docs/components/snippet), and [SecretValue](/docs/components/secret-value) apply it. Labels and prose stay out of it.

**Do:** Set hashes in `mono.m1`, so they align and `I`, `l`, `0`, and `O` stay distinct.

```tsx
/**
 * Do example for "Use Monospace for Hashes and Code" on the Typography page.
 * Set hashes in a `.mono` set, so they align and `I`, `l`, `0`, and `O` stay distinct.
 * @module
 */
import { style } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.column()}>
      <span {...styles.value()}>0x1f0a9c3e7b11d4e0</span>
      <span {...styles.value()}>0x8d1Il0O4e2b7a96c</span>
      <span {...styles.value()}>0x7777a1b2c3d4e5f6</span>
    </div>
  )
}

namespace styles {
  export const column = style({ display: 'grid', gap: '8' })

  export const value = style({ color: 'content.primary', typography: 'mono.m1' })
}
```

**Don't:** Set hashes in a proportional set, where equal-length values drift apart.

```tsx
/**
 * Don't example for "Use Monospace for Hashes and Code" on the Typography page.
 * Don't set hashes in a proportional set, where equal-length values drift apart.
 * @module
 */
import { style } from '@tempoxyz/ds'

/** Renders the static preview, which the guideline card shows inert. */
export function Demo() {
  return (
    <div {...styles.column()}>
      <span {...styles.value()}>0x1f0a9c3e7b11d4e0</span>
      <span {...styles.value()}>0x8d1Il0O4e2b7a96c</span>
      <span {...styles.value()}>0x7777a1b2c3d4e5f6</span>
    </div>
  )
}

namespace styles {
  export const column = style({ display: 'grid', gap: '8' })

  export const value = style({ color: 'content.primary', typography: 'body.b3' })
}
```

### Keep Lines Readable

* **Line Length (45 to 75 characters):** Cap paragraphs with `maxWidth: '65ch !custom'`. Dialogs already cap their width.
* **Alignment:** Left-align text. Center only short text, such as an empty state title.
* **Minimum Size (12px):** Don't set interface text smaller. The smallest body set, `body.b3`, stops here.
