Keyboard shortcut: Ctrl + K
Get started

Typography

VTypography applies a typography role to a text element.

Usage

vue

A design system is a contract, not a folder of components.

<script setup lang="ts">
import { VTypography } from 'vectis-ui'
</script>

<template>
  <VTypography>A design system is a contract, not a folder of components.</VTypography>
</template>

Examples

Variants

variant sets the font size, weight, line height and other typography settings for the chosen role.

vue
display

Pack my box with five dozen jugs.

heading-1

Pack my box with five dozen jugs.

heading-2

Pack my box with five dozen jugs.

heading-3

Pack my box with five dozen jugs.

heading-4

Pack my box with five dozen jugs.

subtitle

Pack my box with five dozen jugs.

body-xl

Pack my box with five dozen jugs.

body-lg

Pack my box with five dozen jugs.

body-md

Pack my box with five dozen jugs.

body-sm

Pack my box with five dozen jugs.

label

Pack my box with five dozen jugs.

caption

Pack my box with five dozen jugs.

overline

Pack my box with five dozen jugs.

code

Pack my box with five dozen jugs.

<script setup lang="ts">
import { VTypography, type TypographyVariant } from 'vectis-ui'

const variants: TypographyVariant[] = [
  'display',
  'heading-1',
  'heading-2',
  'heading-3',
  'heading-4',
  'subtitle',
  'body-xl',
  'body-lg',
  'body-md',
  'body-sm',
  'label',
  'caption',
  'overline',
  'code',
]
</script>

<template>
  <div class="table">
    <template v-for="variant in variants" :key="variant">
      <VTypography variant="code" as="span" tone="muted">{{ variant }}</VTypography>
      <VTypography :variant="variant" as="p">Pack my box with five dozen jugs.</VTypography>
    </template>
  </div>
</template>

<style scoped>
.table {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;
  gap: var(--vectis-space-3) var(--vectis-space-5);
}
</style>

Tones

tone sets a semantic text colour. default inherits the surrounding colour.

vue

default: pack my box with five dozen jugs.

muted: pack my box with five dozen jugs.

subtle: pack my box with five dozen jugs.

accent: pack my box with five dozen jugs.

danger: pack my box with five dozen jugs.

success: pack my box with five dozen jugs.

warning: pack my box with five dozen jugs.

on-inverse: pack my box with five dozen jugs.

<script setup lang="ts">
import { VTypography, type TypographyTone } from 'vectis-ui'

// Show on-inverse against an inverted surface.
const tones: TypographyTone[] = [
  'default',
  'muted',
  'subtle',
  'accent',
  'danger',
  'success',
  'warning',
]
</script>

<template>
  <div class="demo">
    <VTypography v-for="tone in tones" :key="tone" :tone="tone">
      {{ tone }}: pack my box with five dozen jugs.
    </VTypography>

    <div class="inverse">
      <VTypography tone="on-inverse">on-inverse: pack my box with five dozen jugs.</VTypography>
    </div>
  </div>
</template>

<style scoped>
.demo {
  display: grid;
  justify-items: start;
  gap: var(--vectis-space-2);
}
.inverse {
  margin-block-start: var(--vectis-space-2);
  padding: var(--vectis-space-2) var(--vectis-space-3);
  border-radius: var(--vectis-radius-surface);
  background: var(--vectis-color-surface-inverse);
}
</style>

The tag it renders

Variants provide default HTML tags. Use as when the document structure requires a different tag.

vue

Rendered as an h4, which is its default

Reads as an h4, is really an h2

<script setup lang="ts">
import { VInput, VTypography } from 'vectis-ui'
</script>

<template>
  <div class="demo">
    <VTypography variant="heading-4">Rendered as an h4, which is its default</VTypography>

    <VTypography variant="heading-4" as="h2">Reads as an h4, is really an h2</VTypography>

    <VTypography variant="label" as="label" for="reference">Reference</VTypography>
    <VInput id="reference" model-value="INV-2481" />
  </div>
</template>

<style scoped>
.demo {
  display: grid;
  justify-items: start;
  gap: var(--vectis-space-3);
  max-inline-size: 22rem;
}
</style>

Truncating to one line

truncate adds a single-line ellipsis. Give the element a constrained width.

vue

A title far too long to sit on one line of a narrow column without being cut

A title far too long to sit on one line of a narrow column without being cut

<script setup lang="ts">
import { VTypography } from 'vectis-ui'

const LONG = 'A title far too long to sit on one line of a narrow column without being cut'
</script>

<template>
  <div class="demo">
    <div class="box">
      <VTypography truncate>{{ LONG }}</VTypography>
    </div>

    <VTypography truncate>{{ LONG }}</VTypography>
  </div>
</template>

<style scoped>
.demo {
  display: grid;
  justify-items: start;
  gap: var(--vectis-space-4);
}
.box {
  inline-size: 16rem;
  padding: var(--vectis-space-3);
  border: 1px dashed var(--vectis-color-border);
  border-radius: var(--vectis-radius-surface);
}
</style>

A block of text

The component adds no margins. Set spacing in the parent layout.

vue
Release notes

What changed in this version

A short standfirst, set one step above the body so the eye knows where to start.

The body role carries the line height a paragraph needs at its size, and long words break rather than push a column out of shape. An inline role sits inside it without disturbing the line: a value such as --vectis-text-body-md-size keeps its own family and size while the leading stays the paragraph's.

Published on 12 September 2026

<script setup lang="ts">
import { VTypography } from 'vectis-ui'
</script>

<template>
  <article class="article">
    <VTypography variant="overline" tone="muted">Release notes</VTypography>
    <VTypography variant="heading-3" as="h2">What changed in this version</VTypography>
    <VTypography variant="body-lg" tone="muted">
      A short standfirst, set one step above the body so the eye knows where to start.
    </VTypography>
    <VTypography variant="body-md">
      The body role carries the line height a paragraph needs at its size, and long words break
      rather than push a column out of shape. An inline role sits inside it without disturbing the
      line: a value such as
      <VTypography variant="code" as="span">--vectis-text-body-md-size</VTypography>
      keeps its own family and size while the leading stays the paragraph's.
    </VTypography>
    <VTypography variant="caption" tone="subtle">Published on 12 September 2026</VTypography>
  </article>
</template>

<style scoped>
.article {
  display: grid;
  justify-items: start;
  gap: var(--vectis-space-3);
  max-inline-size: 34rem;
}
</style>

API

Props

PropTypeDefault
variantTypographyVariant'display' | 'heading-1' | 'heading-2' | 'heading-3' | 'heading-4' | 'subtitle' | 'body-xl' | 'body-lg' | 'body-md' | 'body-sm' | 'label' | 'caption' | 'overline' | 'code''body-md'
Typography role, including font size, weight and line height.
asstringnone
HTML tag. Overrides the variant’s default tag.
toneTypographyTone'default' | 'muted' | 'subtle' | 'accent' | 'danger' | 'success' | 'warning' | 'on-inverse''default'
Semantic text colour. default inherits the surrounding colour.
truncatebooleanfalse
Single-line ellipsis. Requires a constrained width.

Slots

SlotType
default{}
Text content.