Text

New

Consistent typography styling through text variants and raw font-size tokens.

Usage

Use in place of manually applying Text Styles. Examples of manual application you should avoid include:

  • Applying Text Styles classes, e.g. class="d-text-body--md"
  • Combinations of CSS Utilities, e.g. class="d-fs-300 d-fw-semibold d-lh-300"
  • Custom CSS, e.g. .foo { font: var(--dt-typography-body-md); }.

Guidance

  • Prefer DtText over individual typography utility classes to keep implementations aligned with token updates.
  • Use the default slot for rich content. The text prop provides a simple fallback string when no slot content is present.
  • Choose the as prop to match the semantic HTML element (e.g., h1, label, p).
  • Use variant for complete text compositions and pair size with variant only when a raw font-size override is needed.
  • Most properties are optional, as they layer in on top of each other.

Do

  • Replace multiple d- typography classes with a single dt-text instance.
  • Pick the smallest variant that conveys the desired hierarchy.
  • Pair size with variant when the composition is right but the font size needs a token-backed override.
  • Use tone for semantic color tokens instead of standalone d-fc-* classes.

Don’t

  • Mix DtText with conflicting typography utilities (e.g., d-fs-*).
  • Render headings with non-heading tags (e.g., avoid as="div" for top-level titles).
  • Depend on the text prop when the content requires inline formatting; slot it instead.

Variants

Variant

Use variant to apply a complete text composition, including font family, font size, font weight, and line height. Default will inherit styles from the parent.

Size

Using size with variant acts as an override of the font-size over its composed default. It applies a raw font-size token while keeping the rest of the composition. size will not work by itself, as it requires pairing with variant, or with legacy kind when migrating older usages.

Size Output Example
50 10px Text
75 11px Text
100 12px Text
125 13px Text
150 14px Text
200 16px Text
250 18px Text
300 20px Text
350 22px Text
400 26px Text
450 29px Text
500 32px Text
550 36px Text
600 42px Text
650 46px Text
700 52px Text
750 58px Text
800 66px Text

Legacy kind

T-shirt sizes such as xs, sm, md, and lg belong in variant names for new usage. Numeric size values are raw font-size tokens when paired with variant; with legacy kind, they keep the historical composition mapping.

Numeric

The numeric prop applies styles that ensure that each number is set with consistent width, making them align properly when displayed together. Ideal for displaying aligned data such as phone numbers or numbers in a table.

Strength

Override the font-weight of the text. Applies to any kind/size combination. If omitted, the default weight from the typography token is used.

Density

Override the line-height of the text. Applies to any kind/size combination. If omitted, the default line-height from the typography token is used.

Family

Override the font family. By default, DtText does not emit a font-family class and inherits naturally from the parent.

Italic

Use the italic prop to apply italic font style. When omitted or false, DtText does not emit a font-style override.

Tone

Use tone to declare the text's tone, which will map to a foreground color. By default, the tone is inherited from its parent.

Inverted

Rather than use the -inverted tone variants, use the v-dt-mode directive.

Render as

Use as to declare the underlying HTML tag that the component should render, independent of the visual styling. Defaults to span.

Align

Since DtText's default element is a <span>, which is inline by default, the align prop will only work if its element is styled in a block context.

Truncate

Since DtText's default element is a <span>, the truncate will only work if its element is in block or inline-block context, e.g. <div>...</div>.

Max Lines

Wrap

Control text wrapping behavior. Particularly useful for headlines where balanced line lengths improve readability.

Since DtText's default element is a <span>, which is inline by default, the wrap prop will only work if its element is styled in a block context.

Text Box Trim

Remove extra leading space above and/or below text. Useful for tight component layouts where text needs to align precisely with adjacent elements.

Text box trim will only affect elements with block or inline-block styled context. It may have no effect on elements with inline or flex context.

Do

  • Use text-box-trim="both" when text needs to align flush with container's top and/or bottom edges.

Don’t

  • Apply text-box-trim to body copy that benefits from natural line spacing.
  • Use text-box-trim as a substitute for proper layout spacing.

Examples

Profile Card

Call Log

Accessibility

  • Maintain semantic structure via as (e.g., screen readers expect heading levels to be sequential).
  • When using truncate, provide another way to access the full content (tooltip, detail view, or explicit aria-label). DtText does not apply alternative access to the full string, so consuming applications should opt in.
  • Allow numeric content to remain readable by enabling the numeric prop when aligning tables or numbers that dynamically update.

Vue API

import { DtText } from '@dialpad/dialtone-vue';

Slots

Name
Type
default

Default slot for text content

Props

Name
Default
Type
align
null
"start" | "center" | "end" | "justify"

Logical text alignment. Requires block/inline-block context.

as
'span'
"span" | "p" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label" | "div" | "component"

HTML tag or component used for rendering.

density
null
"100" | "200" | "300" | "400" | "500" | "600"

Overrides line-height. Applies to any kind/size combination.

family
null
"inherit" | "custom" | "sans" | "mono" | "expressive"

Overrides font-family. By default, no font-family class is emitted and text inherits naturally.

italic
false
boolean

Applies italic font style when true.

maxLines
null
number

Applies multi-line truncation (i.e. clamp) when greater than zero; requires block/inline-block context.

numeric
false
boolean

Renders numeric content with tabular figures.

size
null
"50" | "75" | "100" | "125" | "150" | "200" | "250" | "300" | "350" | "400" | "450" | "500" | "550" | "600" | "650" | "700" | "750" | "800"

Raw font-size token. Must be paired with variant for overrides or legacy kind for composition size.

strength
null
"bold" | "semibold" | "medium" | "normal"

Overrides font-weight. Applies to any kind/size combination.

textBoxTrim
null
"start" | "end" | "both"

Controls text-box-trim (leading space above/below text). Useful for tight component layouts.

tone
null
"primary" | "secondary" | "tertiary" | "muted" | "disabled" | "placeholder" | "critical" | "critical-strong" | "positive" | "positive-strong" | "warning" | "info" | "info-strong" | "neutral-black" | "neutral-white"

Semantic foreground color.

truncate
false
boolean

Enables single-line truncation (i.e. ellipsis) when true; requires block/inline-block context.

variant
null
"headline-3xl" | "headline-2xl" | "headline-xl" | "headline-lg" | "headline-md" | "headline-sm" | "headline-xs" | "body-lg" | "body-md" | "body-sm" | "body-xs" | "label-lg" | "label-md" | "label-sm" | "label-xs" | "code-lg" | "code-md" | "code-sm" | "code-xs"

Typography variant mapping to a complete token-backed composition.

wrap
null
"wrap" | "nowrap" | "balance" | "pretty"

Controls text wrapping behavior.

kind Deprecated
null
"headline" | "body" | "label" | "code"

Typography kind mapping to headline/body/label/code token sets.

Use variant instead

Classes

Class
Applies to
Description

Text documentation last updated Friday, September 4, 2026

fix/popover-modal-zindex-scope