Text
Alignment target:@astryxdesign/core v0.7.1 · Text
Body text is for reading.
<Text
type="body"
color="primary"
weight="regular"
>
Body text is for reading.
</Text>Props #
| Name | Type | Default | Description |
|---|---|---|---|
type | TextType | 'body' | Semantic text type. Determines default size, weight, and line-height. Optional: body, large, label, supporting, code, display-1, display-2, display-3. |
size | TextSize | - | Explicit font size override. Optional: sm, md, lg, xl. |
color | TextColor | 'primary' | Text color. Optional: primary, secondary, accent, disabled, placeholder, inherit. |
weight | TextWeight | - | Font weight override. Optional: regular, normal, medium, semibold, bold. normal is the same weight as regular. |
textWrap | TextWrap | - | Wrapping behavior: wrap, nowrap, balance, or pretty. |
wordBreak | TextWordBreak | - | How a long unbroken string breaks when truncating: normal, break-word, or break-all. Without truncation, a token longer than its line (a URL, an ID) wraps (overflow-wrap: break-word), so in ordinary flow the text does not make the page scroll sideways. Inside a flex row, give the flex child min-width: 0 so it can shrink. A container you style with overflow-wrap: anywhere does not reach this text; Astryx's own containers pass their wrap through. |
hasCapsize | boolean | false | Trims the leading above the cap height and below the baseline with text-box-trim, so glyphs sit flush with the box edges. Forces block layout. |
hasStrikethrough | boolean | false | Draws a line through the text. |
hasTabularNumbers | boolean | false | Uses tabular figures so digits line up across rows. |
display | TextDisplay | 'inline' | Display type: inline or block. |
as | TextAs | 'span' | HTML element to render. Optional: span, p, div, label, h1, h2, h3, h4, h5, h6. Heading tags render a real heading element but keep Text typography; use Heading for heading sizing. |
justify | 'start' | 'center' | 'end' | 'start' | Text alignment. start and end follow the writing direction. |
hasTruncateTooltip | boolean | 'above' | 'below' | 'start' | 'end' | true | Puts the full text in a tooltip after truncation. false turns it off and skips the measurement. It stays closed when the text fits. The tooltip mounts on the first hover, tap or keyboard focus; until then the element has no tooltip layer and no aria-describedby. |
maxLines | number | 0 | Maximum lines before truncation. 0 means no truncation. A positive value forces block layout so the ellipsis has a width. |
Native attributes #
The root element is determined by as, defaulting to <span>.
The following are passed to the root element:
- HTML attributes.
aria-*attributes.data-*attributes.class.style.