Raccourci clavier : Ctrl + K
Commencer

Typographie

VTypography applique un style typographique à un élément de texte.

Utilisation

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>

Exemples

Variantes

variant définit la taille, la graisse, la hauteur de ligne et les autres réglages du style choisi.

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>

Tonalités

tone définit une couleur de texte sémantique. default hérite de la couleur environnante.

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>

La balise rendue

Les variantes fournissent des balises HTML par défaut. Utilisez as si la structure du document en exige une autre.

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>

Tronquer sur une ligne

truncate tronque le texte sur une ligne avec des points de suspension. Limitez la largeur de l’élément.

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>

Un bloc de texte

Le composant n’ajoute aucune marge. Définissez l’espacement dans la disposition parente.

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

PropTypeDéfaut
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'
Style typographique, avec taille, graisse et hauteur de ligne.
asstringaucune
Balise HTML. Remplace celle de la variante.
toneTypographyTone'default' | 'muted' | 'subtle' | 'accent' | 'danger' | 'success' | 'warning' | 'on-inverse''default'
Couleur de texte sémantique. default hérite de la couleur environnante.
truncatebooleanfalse
Troncature sur une ligne. Nécessite une largeur limitée.

Slots

SlotType
default{}
Contenu textuel.