Text
Alignment target:@astryxdesign/core v0.7.1 · Text
Usage #
Import the component from its dedicated entry. Structural styles are loaded automatically.
<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
| Element | Description |
|---|---|
| Text | Polymorphic text element that renders the supplied content with themed typography. |
| Heading | Referenced Heading member that renders the supplied content as a semantic h1–h6 element. |
| Truncation tooltip | Tooltip-owned surface available only when Text or Heading is measured as truncated and truncation tooltips are enabled. |
Best practices #
| Guidance | Practice |
|---|---|
| Recommended | Use type for semantic hierarchy: large for emphasis, supporting for hints, label for form labels. |
| Recommended | Set as="p" or display="block" when you need block-level layout. |
| Recommended | Use maxLines to clamp long text to a fixed number of lines. |
| Don't | Use Text in place of Heading. Headings should use the Heading component for correct semantics. |
| Don't | Mix too many type and size combinations in the same short passage. |
Examples #
Text — Colors
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
Heading levels 1 through 6, with the type scale stepping down at each level.
Text — Inline
Text is inline by default, so body copy and a code span can share one line.
Text — Truncation
maxLines clamps a paragraph to one, two, or three lines and ends the overflow with an ellipsis.
Text — Types
The body, large, label, supporting, and code types, plus strikethrough and tabular figures.
Text — Weight
Normal, medium, semibold, and bold. Normal is the same weight as regular.
Text — Word break
break-word keeps a long token together when it can; break-all splits it at any character.
Text — Wrap
Wrap, nowrap, balance, and pretty, each in a box of the same width.