Usage
Text components (including heading and body roles in the design system) apply consistent type scale, color, weight, and semantics to strings. They are the default way to render readable content instead of ad hoc styles. The mental model is “meaning plus appearance”—pick the role that matches the job, not only the pixel size.
formatMessageProps.| Role / type | Purpose | Emphasis |
|---|---|---|
| Display / Heading / Subheading / Title | Section hierarchy | One Display per view or major region; don’t skip levels |
| NumericDisplay / NumericCompact | Large numbers that must stay a span | 2.4rem and 1.8rem. MetricCard always uses NumericDisplay |
| BodyLarge / BodyBase / BodySmall | Body ladder | BodySmall for secondary metadata, not for primary instructions alone |
| Label / Button | Compact UI and action-aligned copy | Label for field labels; Button for text that matches button typography |
| Overline | Eyebrows or badges | Use sparingly; test readability |
| Caption | Supporting one-line text | Secondary context without competing with body |
| MonoMedium / MonoSmall | Monospace literals | IDs, code, tokens; pick scale by density |
| Semantic colors | Status and tone | Pair with icons or text for color-blind users |
CoreText renders semantic elements (h1–h4 for display heading types, p or span for body and other types) with token-driven styling. NumericDisplay and NumericCompact stay spans at heading sizes so a metric value is never an h*. Alignment, truncation, no-wrap, and transformation props adjust layout but should not fight the content’s natural reading pattern.
Opt in with animation={{ type: TextAnimation.Odometer, value, from? }}. Every reel element carries the root’s text type, weight, and color, so font-size, family, line-height, letter-spacing, and glyph width are identical with or without animation. Digit windows derive their geometry from the inherited font metrics. Heading types are excluded from OdometerTextType; use NumericDisplay or NumericCompact for large animated numbers.
from only when the entrance should roll. Omission snaps.announcement. Default live is off.formatMessage; plan for expansion in German and Romance languages.onClick on plain text.Do
Success, Warning, Error) consistently with product meaning.Don’t
h* vs p).formatMessage fragments must remain keyboard accessible when they include links or buttons.