Text

Alignment target:@astryxdesign/core v0.7.1 · Text

Body: The bulk of content Large: Emphasized content Label: Form and chart labels Supporting: Helper text Code: const x = 42;

Usage #

Import the component from its dedicated entry. Structural styles are loaded automatically.

Vue
<script setup lang="ts">
import { Text } from '@astryx-vue/core/Text'
</script>

<template>
  <Text type="body">
    Body content
  </Text>
  <Text type="supporting">
    Supporting details
  </Text>
</template>

Anatomy

ElementDescription
TextPolymorphic text element that renders the supplied content with themed typography.
HeadingReferenced Heading member that renders the supplied content as a semantic h1–h6 element.
Truncation tooltipTooltip-owned surface available only when Text or Heading is measured as truncated and truncation tooltips are enabled.

Best practices #

GuidancePractice
RecommendedUse type for semantic hierarchy: large for emphasis, supporting for hints, label for form labels.
RecommendedSet as="p" or display="block" when you need block-level layout.
RecommendedUse maxLines to clamp long text to a fixed number of lines.
Don'tUse Text in place of Heading. Headings should use the Heading component for correct semantics.
Don'tMix too many type and size combinations in the same short passage.

Examples #

Text — Colors

Primary — Default for headings and body textSecondary — Supporting details and metadataAccent — Links, emphasis, and accent-colored textDisabled — Unavailable or inactive contentPlaceholder — Empty field hints
Open in Playground

Primary, secondary, accent, disabled, and placeholder colors, each used for the kind of text it names.

Text — Heading levels

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
Open in Playground

Heading levels 1 through 6, with the type scale stepping down at each level.

Text — Inline

Design tokens are themeable and shared across every surface.
Open in Playground

Text is inline by default, so body copy and a code span can share one line.

Text — Truncation

1 line
The design system provides a consistent set of typography tokens, spacing scales, and color palettes that ensure every surface in the product feels cohesive regardless of which team built it.
2 lines
The design system provides a consistent set of typography tokens, spacing scales, and color palettes that ensure every surface in the product feels cohesive regardless of which team built it.
3 lines
The design system provides a consistent set of typography tokens, spacing scales, and color palettes that ensure every surface in the product feels cohesive regardless of which team built it.
Open in Playground

maxLines clamps a paragraph to one, two, or three lines and ends the overflow with an ellipsis.

Text — Types

Body textBody text for paragraphs and general content
Large textLarge text for introductions and callouts
Label textLabel text for form fields and section titles
Supporting textSupporting text for captions and metadata
Code textconst theme = defineTheme({})
StrikethroughBody text with strikethrough decoration
Tabular numbers1,234.56 78.90 100,000.00
Open in Playground

The body, large, label, supporting, and code types, plus strikethrough and tabular figures.

Text — Weight

NormalMediumSemiboldBold
Open in Playground

Normal, medium, semibold, and bold. Normal is the same weight as regular.

Text — Word break

Break-word (default for multi-line)
This is a verylongunbreakableword for a break-word example
Break-all (default for single-line)
Breaks anywhere: abcdefghijklmnopqrstuvwxyz0123456789
Open in Playground

break-word keeps a long token together when it can; break-all splits it at any character.

Text — Wrap

Wrap (default)
This text wraps normally at word boundaries when it reaches the edge.
Nowrap
This text does not wrap and will overflow its container.
Balance
This text is balanced for better visual appearance across lines.
Pretty
This text uses pretty wrap to avoid orphans at the end of paragraphs.
Open in Playground

Wrap, nowrap, balance, and pretty, each in a box of the same width.