StartFoundationsComponentsContent

Text

Text renders a run of text in one of the system's type roles. The look (variant) and the element (as) are set separately.

Stable Figma
OverviewUsageAPIAccessibility
Billing history Your plan renews on 27 March 2026. Prices include VAT.
<tk-text variant="title-md" as="h3">Billing history</tk-text>
<tk-text>Your plan renews on 27 March 2026.</tk-text>
<tk-text variant="caption" color="secondary">Prices include VAT.</tk-text>

Anatomy

Part What it is
tk-text the element; renders the tag you choose with as
default slot the text, required; it is also the accessible name
text part the rendered element inside

Variants

Display Small Title Small Heading Medium Body Medium Label Medium Code Small
<tk-text variant="display-sm">Display Small</tk-text>
<tk-text variant="title-sm">Title Small</tk-text>
<tk-text variant="heading-md">Heading Medium</tk-text>
<tk-text variant="body-md">Body Medium</tk-text>
<tk-text variant="label-md">Label Medium</tk-text>
<tk-text variant="code-sm">Code Small</tk-text>

variant is the type role. Size, line height, weight, and family come from it.

variant Size / line height Weight
display-lg 64 / 72 600
display-md 48 / 56 600
display-sm 40 / 48 600
title-lg 32 / 40 600
title-md 28 / 32 600
title-sm 24 / 28 600
heading-md 20 / 24 600
heading-sm 18 / 24 600
body-lg 18 / 28 400
body-md (default) 16 / 24 400
body-sm 14 / 20 400
label-lg 16 / 24 500
label-md 14 / 20 500
label-sm 12 / 16 500
caption 12 / 16 400
code-md 16 / 24 400, mono
code-sm 14 / 20 400, mono
  • Display: promo headlines. Title: page and section headings. Heading: short headings inside a block.
  • Body: running text. Label: UI text. Caption: quiet supporting text.
  • Code: machine text in the mono family.

Element

Billing history Welcome back
<tk-text variant="title-md" as="h3">Billing history</tk-text>
<tk-text variant="body-lg" as="h2">Welcome back</tk-text>

as sets the real HTML element: p (default), span, div, label, code, or h1–h6. Screen readers and heading navigation see that element.

  • Pick the heading level from the page outline, then pick the variant that looks right. One h1 per page; don't skip levels.
  • span and code are inline; use them to style a phrase inside other text.
  • as="code" doesn't change the font. Pair it with code-md or code-sm.
  • as="label" doesn't label a form control. Use Field for that.

Color

Last edited by Ada Payment received Card declined
<tk-text color="secondary">Last edited by Ada</tk-text>
<tk-text color="success">Payment received</tk-text>
<tk-text color="error">Card declined</tk-text>

color takes a text role, so it works in every theme.

color Use for
default (default) main reading text
secondary supporting text
tertiary the least important text
accent emphasis in the accent color; not clickable
success / warning / error / info status text
inverse text on an inverse (dark) surface

Use a status color for that status only, not for decoration. Placeholder, disabled, and on-fill colors aren't offered; the components that need them set them.

Weight, alignment, truncation, italic

This word is important. Centered text Photo by the author
Quarterly report for the north-east region, final draft
<tk-text>This word is <tk-text as="span" weight="bold">important</tk-text>.</tk-text>
<tk-text align="center">Centered text</tk-text>
<tk-text italic color="secondary">Photo by the author</tk-text>
<div style="max-inline-size: 16rem">
  <tk-text truncate>Quarterly report for the north-east region, final draft</tk-text>
</div>
  • weight: regular (400), medium (500), semibold (600), or bold (700). Only the weight changes. Use it for a bold word in body text, not to fake a heading.
  • align: start, center, or end; they follow the writing direction. Unset, the text inherits the container's alignment.
  • truncate: one line with an ellipsis. It needs a bounded width. Screen readers still read the full text; if sighted readers need it, add a Tooltip.
  • italic: the whole run in italic, as styling only. For stress inside a sentence, use <em>.

Text has no outer margins. Spacing between blocks is the layout's job, or use Prose.