---
title: Typography
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { Typography } from '@telus-uds/components-base'
import { Typography as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnBoth from '../../partials/_platform-considerations-both.mdx'
import SubscriptAndSuperscriptNote from '../../partials/_subscript-and-superscript-note.mdx'

# Typography

<LibraryInfo figmaLink="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FVNEufUGHekVpqtPpqgjRy0%2F%25F0%259F%258D%2580-Allium-Typography%3Fnode-id%3D45%253A0" />

```jsx live
<Typography>The quick brown fox jumps over the lazy dog</Typography>
```

## Introduction

Typography can be used to achieve a variety of different typographic styles. Size, weight, colour and semantic markup are all controlled using the variants described below.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

For main body text on web, [`Paragraph`](paragraph) component should be used instead.

### Headings

- Be mindful of SEO and accessibility
- Organize headers in a nested order: h1, then h2, then h3
- Try not to skip levels where possible: h1, then h3
- Use one h1 per page
- For Hero overlays, Headlines, or Promo blocks, use DisplayHeading
- For subtext in the Hero overlays, or Headlines, use Text
- Limit bolding in headings to emphasize words, rather than the whole heading itself

See [Accessibility](#accessibility) section on this page for more guidance on headings and other tags.

### Spacing

Typography components **do not** have built-in margins. Spacing options include:

- [Paragraph](paragraph) (web only) applies space based on line height between itself and siblings.
- [Box](box) parent can apply spacing around typography components as a parent.
- [Spacer](spacer) may be used to add space before or after a typography component.
- [StackView](spacer) adds even space between its children.

### Subscript and superscript

<SubscriptAndSuperscriptNote />

### Accessibility

#### Semantic tags

Semantic HTML tags for text may be set using:

- `heading` prop for `h1`, `h2`, `h3`, `h4`, `h5`, `h6`
- `tag` prop for `label`, `strong`, `em`, `dd`, `dt`, `code`, `blockquote`, `del`, `ins`, `li`; but see also:
  - [Blockquote](block-quote) component is preferred for on-brand blockquotes
  - [InputLabel](input-label) component is preferred for on-brand labels
  - [List and List.Item](list) components are preferred for on-brand lists

`p` and `span` tags are not supported in Typography because they are not directly supported in React Native Web. Instead, web-only implementations are available via the [Paragraph](paragraph) and [Span](span) components.

#### Separate semantic meaning from visual styling

The above controls for semantic tags do not affect Typography's appearance or visual styling in any way.
This allows developers, designers, and content editors to represent headings with a certain style while rendering a HTML tag of their choice.
It's important to maintain a correct order of heading level and not skip levels; for example, have a `<h2>` HTML element that directly follows a `<h1>`, or a `<h3>` that directly follows a `<h2>`.
This simple yet powerful feature allows users of assistive technology to navigate through content predictably since headings represent information hierarchy, while we also balance an appropriate visual hierarchy.

In the promotional content example below.

- The first line of text appears as a `H4`, but renders with a `<h1>` tag.
- The second line of text appears as a `Display2`, but renders with a `<h2>`.
- The third line of text appears as `Large` text, but renders with a `<div>`.

```jsx live
<>
  <Typography block variant={{ size: 'h4' }} heading="h1">
    Consider this: $0 first month
  </Typography>
  <Typography block variant={{ size: 'display2' }} heading="h2">
    Stream live TV on any screen
  </Typography>
  <Typography block variant={{ size: 'large' }}>
    Stream live TV or On Demand shows and movies on any screen with TELUS Pik TV. Get Pik TV from
    just $10 a month, and get your first month for $0 when you sign up.
  </Typography>
</>
```

### Platform considerations

<AvailableOnBoth />

## Props

<PropsTable base={BaseDocs} />

## Tokens

<TokensTable base={BaseDocs} component="Typography" />

## Variants

Note that the Display heading styles, and h1-3 all have different behaviour at `lg` and `xl` viewports.

### Colors

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Default colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'default' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Brand colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'brand' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Dark colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'dark' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Light colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'light' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Positive colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'positive' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Warning colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'warning' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Danger colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'danger' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Black colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'black' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    White colour
  </Typography>
  <Box variant={{ background: 'dark' }}>
    <Typography block variant={{ size: 'h1', colour: 'white' }}>
      Let’s make the future friendly
    </Typography>
  </Box>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Brand 2 colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'brand2' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Brand 3 colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'brand3' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Alternative 1 colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'alternative1' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Alternative 2 colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'alternative2' }}>
    Let’s make the future friendly
  </Typography>

  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>

  <Typography block variant={{ size: 'eyebrow' }}>
    Alternative 3 colour
  </Typography>
  <Typography block variant={{ size: 'h1', colour: 'alternative3' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### Gradient Color Text

:::caution
Please note that this feature is only available for web
:::

Note that passing prop `variant={{ colour: 'alternative1' }}` will add gradient color text as seen in the examples below. This feature is exclusively available for web platforms. The way the gradient displays is influenced by the overall size of the element it's applied to. The color change is not directly tied to the text itself but to the element's dimensions that the text occupies. Therefore, as the text lengthens and the element's width increases, you'll notice more of the gradient effect, showcasing a more distinct transition from one color to the other.

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Alternative 1 gradient
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'h1', colour: 'alternative1' }}>
    Let’s make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'large', colour: 'alternative1' }}>
    Stream live TV or On Demand shows and movies on any screen with TELUS Pik TV. Get Pik TV from
    just $10 a month, and get your first month for $0 when you sign up.
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'medium', colour: 'alternative1' }}>
    At TELUS®, our approach to accessibility is about much more than ticking boxes and meeting
    minimum standards. We want to give everyone equal access to the devices and services we all need
    to work, play and stay connected.
  </Typography>
</>
```

## Headings

#### Display 1

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Display 1
  </Typography>
  <Typography block variant={{ size: 'display1' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### Display 2

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Display 2
  </Typography>
  <Typography block variant={{ size: 'display2' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### H1

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    H1
  </Typography>
  <Typography block variant={{ size: 'h1' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### H2

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    H2
  </Typography>
  <Typography block variant={{ size: 'h2' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### H3

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    H3
  </Typography>
  <Typography block variant={{ size: 'h3' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### H4

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    H4
  </Typography>
  <Typography block variant={{ size: 'h4' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### H5

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    H5
  </Typography>
  <Typography block variant={{ size: 'h5' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### H6

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    H6
  </Typography>
  <Typography block variant={{ size: 'h6' }}>
    Let’s make the future friendly
  </Typography>
</>
```

### Body

#### Default Styles

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Large
  </Typography>
  <Typography block variant={{ size: 'large' }}>
    Let’s make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Medium (default)
  </Typography>
  <Typography block>Let’s make the future friendly</Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Small
  </Typography>
  <Typography block variant={{ size: 'small' }}>
    Let’s make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Micro
  </Typography>
  <Typography block variant={{ size: 'micro' }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### Body Bold

Bold styles are available on all body sizes.

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Large
  </Typography>
  <Typography block variant={{ size: 'large', bold: true }}>
    Let’s make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Medium (default)
  </Typography>
  <Typography block variant={{ bold: true }}>
    Let’s make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Small
  </Typography>
  <Typography block variant={{ size: 'small', bold: true }}>
    Let’s make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Micro
  </Typography>
  <Typography block variant={{ size: 'micro', bold: true }}>
    Let’s make the future friendly
  </Typography>
</>
```

#### Body Compact

Compact is only available for body text in sizes small, medium, and large. Use compact text for short content such as UI elements, convey data and other short-form content.
Don’t use for marketing or longer reading materials that need paragraphs.

Additional guidance required. Limit use as necessary.

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Large
  </Typography>
  <Typography block variant={{ size: 'large', compact: true }}>
    Let's make the future friendly
  </Typography>
  <Typography block variant={{ size: 'large', compact: true, bold: true }}>
    Let's make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Medium (default)
  </Typography>
  <Typography block variant={{ compact: true }}>
    Let's make the future friendly
  </Typography>
  <Typography block variant={{ compact: true, bold: true }}>
    Let's make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Small
  </Typography>
  <Typography block variant={{ size: 'small', compact: true }}>
    Let's make the future friendly
  </Typography>
  <Typography block variant={{ size: 'small', compact: true, bold: true }}>
    Let's make the future friendly
  </Typography>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Typography block variant={{ size: 'eyebrow' }}>
    Micro
  </Typography>
  <Typography block variant={{ size: 'micro', compact: true }}>
    Let's make the future friendly
  </Typography>
  <Typography block variant={{ size: 'micro', compact: true, bold: true }}>
    Let's make the future friendly
  </Typography>
</>
```

### Eyebrow

```jsx live
<>
  <Typography block variant={{ size: 'eyebrow' }}>
    Default Eyebrow
  </Typography>
</>
```

### Strikethrough

```jsx live
<>
  <Typography block strikeThrough>
    Strikethrough
  </Typography>
</>
```

### Nested Strikethrough

```jsx live
<>
  <Typography block>
    Hello world <Typography strikeThrough>striked text</Typography>
  </Typography>
</>
```

### Inverse

All text styles can be inverted for use on a dark background

```jsx live dark
<>
  <Box variant={{ background: 'dark' }}>
    <Typography block variant={{ size: 'display1', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'display2', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'h1', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'h2', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'h3', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'h4', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'h5', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'h6', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'large', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'small', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'micro', inverse: true }}>
      Let’s make the future friendly
    </Typography>
    <Typography block variant={{ size: 'eyebrow', inverse: true }}>
      Let’s make the future friendly
    </Typography>
  </Box>
</>
```

## Feedback

<Feedback component="Typography" />
