Anta design system

Text

A block-level text container that scopes the color hierarchy of its contents. Use priority to dial the emphasis from primary (most prominent, --text-1) down to quinary (least prominent, --text-5), and tone to apply a tinted palette (brand, success, critical, warning, info). Pass inline to render as inline-block for use in the middle of other text.

Text also owns Anta’s prose-link styling. Links nested inside <Text> are styled by the design system — there are no per-page overrides to maintain.

Props

PropTypeDescription
expandable?booleanShow a fade hint and chevron over the truncated text and let the user expand it by clicking the chevron region or pressing Enter while the chevron has keyboard focus. Only takes effect together with `truncate`.
inline?booleanRender as inline-block instead of the default block element.
priority?'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary'Visual priority. Maps to text-1..text-5. Defaults to 'primary' (text-1).
tone?'info' | 'brand' | 'success' | 'critical' | 'warning'Color tint. Applies the matching `--text-{N}-{tone}` palette.
truncate?number | booleanTruncate with a trailing ellipsis. `true` (or `1`) clamps to a single line; any integer ≥ 2 clamps to that many lines. Uses the `-webkit-line-clamp` technique, supported in all major browsers (Firefox 68+, Chrome, Safari, Edge).
Inherited props (className, style, children)
PropTypeDescription
className?stringCSS class name. Merged with any internal classes by the component.
style?CSSPropertiesInline styles applied to the root element.
children?ReactNodeChild elements. When provided, replaces the component's default label/content.

Examples

Priority

<Text priority="primary">Primary emphasis</Text>
<Text priority="secondary">Secondary emphasis</Text>
<Text priority="tertiary">Tertiary emphasis</Text>
<Text priority="quaternary">Quaternary emphasis</Text>
<Text priority="quinary">Quinary emphasis</Text>

Tinted

<Text tone="info" priority="secondary">Informational note</Text>
<Text tone="critical">Something broke</Text>
<Text tone="success" priority="tertiary">Saved</Text>

Inline

<p>
This paragraph has a <Text inline tone="info">tinted phrase</Text>{' '}
in the middle.
</p>

Truncate

{/* Single line */}
<Text truncate>
This very long sentence will be cut off with an ellipsis…
</Text>
{/* Multi-line — pass the line count */}
<Text truncate={3}>
Long paragraph that wraps across many lines but stops at three…
</Text>
truncate
The quick brown fox jumps over the lazy dog repeatedly while the morning sun rises over a sleepy town that nobody has visited in years and years and years.
truncate={2}
The quick brown fox jumps over the lazy dog repeatedly while the morning sun rises over a sleepy town that nobody has visited in years and years and years.
truncate={3}
The quick brown fox jumps over the lazy dog repeatedly while the morning sun rises over a sleepy town that nobody has visited in years and years and years.

truncate accepts either true (or 1) for a single-line ellipsis or any integer ≥ 2 for multi-line clamping. Both modes use -webkit-line-clamp inside display: -webkit-box. Despite the -webkit- prefix, every major browser supports it (Firefox 68+, Chrome, Safari, Edge). The host gets min-width: 0 so truncation works correctly inside flex and grid containers.

Expandable

<Text truncate expandable></Text>
<Text truncate={3} expandable></Text>

Pair expandable with truncate to let the user reveal the full text. Single-line truncation gets a horizontal fade on the right edge; multi-line gets a vertical fade over the last line. A chevron-down hint appears in the bottom-right corner on hover or keyboard focus — clicking the chevron or focusing the element and pressing Enter expands the text and the clamp is removed. The element is exposed as role="button" with aria-expanded while collapsed; once expanded it reverts to plain text.

truncate expandable
The quick brown fox jumps over the lazy dog repeatedly while the morning sun rises over a sleepy town that nobody has visited in years and years and years and years.
truncate={3} expandable
The quick brown fox jumps over the lazy dog repeatedly while the morning sun rises over a sleepy town that nobody has visited in years and years and years and years.
truncate={5} expandable
The quick brown fox jumps over the lazy dog repeatedly while the morning sun rises over a sleepy town that nobody has visited in years and years and years and years.
<Text priority="primary">
Read the <a href="#">full guide</a> to get started.
</Text>
<Text priority="tertiary">
Footnote with a <a href="#">muted link</a> that brightens on hover.
</Text>

Links inside <Text> follow a priority-aware hierarchy that keeps emphasis consistent with the surrounding text:

PriorityLink color (default)Link color (hover)
primary--link-color (brand blue)--link-color-hover
secondary--link-color--link-color-hover
tertiarycurrentColor (= --text-3)--text-2
quaternarycurrentColor (= --text-4)--text-3
quinarycurrentColor (= --text-5)--text-4

The underline is a 0.5px hairline at 75% alpha by default and bumps to 1px / 100% alpha on hover. On :active it returns to the 0.5px / 75% resting state.

For tinted text (tone="brand|success|critical|warning|info") links are always muted regardless of priority — they take currentColor and step up to the next-stronger level of the same tint on hover. At priority="primary" there is no level above, so hovering only brings the underline to full alpha.

Demo

Priority — neutral

priority="primary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="secondary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="tertiary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quaternary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quinary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.

Priority — tone="brand"

priority="primary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="secondary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="tertiary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quaternary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quinary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.

Priority — tone="success"

priority="primary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="secondary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="tertiary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quaternary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quinary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.

Priority — tone="critical"

priority="primary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="secondary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="tertiary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quaternary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quinary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.

Priority — tone="warning"

priority="primary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="secondary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="tertiary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quaternary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quinary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.

Priority — tone="info"

priority="primary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="secondary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="tertiary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quaternary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.
priority="quinary"The quick brown fox jumps over the lazy dog with a code pill and a link inside the sentence.

Component tokens

Text derives its colors from the global token system. Every variable below has a light and dark mode value defined in anta_global_tokens.css.

TokenDescription
--text-1--text-5Neutral text levels (most → least prominent)
--text-1-{tone}--text-5-{tone}Tinted text levels for each tone value
--link-colorDefault prose-link color (priorities 1 & 2)
--link-color-hoverHover prose-link color (priorities 1 & 2)

<a-text> itself exposes four internal variables that carry the resolved values into its descendant link rule:

TokenDescription
--text-colorResolved text color for the priority/tone
--text-link-colorColor used by a-text a at rest
--text-link-hoverColor used by a-text a:hover
--text-link-underline-alphaAlpha applied to the underline (50% / 100%)