Text

New

Consistent typography styling through semantic text kinds and sizes.

Preview

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).
  • All 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 kind/size combination that conveys the desired hierarchy.
  • 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

Kind

Declare the role of the content. Default will inherit styles from the parent.

Size

All kinds support size prop, but not all sizes are available for each kind. When kind is set, size defaults to 300 if not specified.

100200300400500600700
headline

Text

Text

Text

Text

Text

Text

Text

body

Text

Text

Text

Text

---
label

Text

Text

Text

Text

---
code TextTextTextText---

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.

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.

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

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

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
"100" | "200" | "300" | "400" | "500" | "600" | "700"

Size variant within the selected kind. Falls back to md/300 if unsupported. Headline supports all sizes; body/label/code support 100-400.

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.

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

Controls text wrapping behavior.

Classes

Class
Applies to
Description

Text documentation last updated Thursday, June 18, 2026