Prepared Docs

Prepared Docs

⌘K

    Loading navigation…

User

  1. Primitives
  2. Text
  3. API and Development

Text

API and Development

View Source
Submit Issue

CoreText displays text content with consistent typography, supporting headings, body text, and styled variations for various contexts throughout the interface. It provides a unified typography system supporting display and section titles, body ladder, labels, overlines, monospace variants, and flexible formatting options. Built on Radix UI's Text and Heading components, it ensures consistent typography across the interface with full accessibility support, internationalization, and responsive behavior.

Props

NameDefaultDescription
typeTextType.BodyBaseTypography variant. Options: Display, Heading, Subheading, Title, NumericDisplay, NumericCompact, BodyLarge, BodyBase, BodySmall, Label, Button, Overline, Caption, MonoMedium, MonoSmall.
animationOpt-in odometer. Requires a numeric value. Heading types are excluded.
headingLevelOverrides the default heading element for the type (e.g. HeadingLevel.H2 while keeping Display styling). When set, renders a Radix Heading with that tag.
colorTextColor.BaseThe text color variant. Options: Base, Alt, Alt2, Disabled, Info, Accent, Success, Warning, Error, Inverted.
alignTextAlign.LeftText alignment. Options: Left, Center, Right.
transformTextTransform.NoneText transformation to apply. Options: None, Uppercase, Lowercase, Capitalize. Overline defaults to Uppercase when transform is None.
strongfalseWhether to apply bold font weight.
mediumfalseWhether to apply medium font weight.
truncatefalseWhether to truncate text with ellipsis when it overflows its container.
noWrapfalseWhether to prevent text from wrapping to multiple lines.
asSpanfalseWhen true, renders as a span instead of a block element (e.g. p). Use for inline text; prefer block elements for standalone paragraphs.
formatMessagePropsProps for internationalization using the Trans component. Requires i18nKey property.
childrenrequiredThe text content to display. Can be a string, React node, or formatted content.

Basic Text

Use for standard body text with default styling.

Headings

Use heading types for page titles, section headers, and hierarchical content structure. Each maps to a default semantic heading tag (h1–h4).

Display

Use for the primary page title or main heading.

Heading

Use for major section headings.

Subheading

Use for subsection headings.

Title

Use for minor headings or content labels.

Numeric display

Non-heading 2.4rem type mapped to --text-heading. Use for metric values that must stay a span. Pair with strong for weight 600.

Numeric compact

Non-heading 1.8rem type mapped to --text-subheading. Use for dense standalone numeric displays that must stay a span; MetricCard always uses NumericDisplay.

Odometer

The reel renders every internal with the root’s text type, weight, and color. Static and animated text therefore use identical font-size, family, line-height, letter-spacing, and glyph metrics at BodySmall, NumericCompact, and NumericDisplay.

Heading level override

Use headingLevel when the visual style should stay on one scale but the semantic tag must differ (for example, a page title that should be h2 for document order).

Text Sizes

Use different text sizes to establish visual hierarchy.

Body large

Use for emphasized body text or introductory content.

Body base

Use for standard body text and paragraphs.

Body small

Use for secondary information, captions, or fine print.

Overline

Use for eyebrows, labels, or distinctive uppercase-style text. Overline applies uppercase styling by default; you can override with transform.

Label

Use for form field labels and compact UI labels (medium weight by default).

Button

Use for text that matches button typography (bold weight by default).

Caption

Use for supporting or secondary one-line text.

Mono medium

Use for monospace content at the medium scale (e.g. code snippets, IDs).

Mono small

Use for compact monospace (e.g. inline tokens, metadata).

Text Colors

Use color variants to convey meaning or establish visual hierarchy.

Semantic Colors

Use semantic colors to communicate meaning or status.

Base Colors

Use base color variants for standard text hierarchy.

Text Alignment

Control text alignment for layout purposes.

Font Weight

Apply different font weights for emphasis or hierarchy.

Bold Text

Use for strong emphasis or important information.

Medium Text

Use for subtle emphasis without full bold weight.

Text Transformation

Apply text transformations for stylistic purposes.

Truncated Text

Truncate text that overflows its container with an ellipsis.

When text is truncated, a title attribute is automatically added with the full text content for accessibility.

No Wrap Text

Prevent text from wrapping to multiple lines.

Combined Properties

Combine multiple properties for complex text styling.

Text with Interactive Elements

Embed interactive elements within text content.

Text with Internationalization

Use the formatMessageProps prop for internationalized text with embedded formatting.

The Trans component handles interpolation and formatting of internationalized content while preserving embedded React components.

Heading Hierarchy

Use headings in a proper semantic hierarchy.

Error Messages

Display error messages with appropriate styling.

Success Messages

Display success messages with appropriate styling.

Form Labels and Help Text

Use text components for form labels and help text.

Previous

Text / Usage

Next

Text / Accessibility

On this page

Props
Basic Text
Headings
Display
Heading
Subheading
Title
Numeric display
Numeric compact
Odometer
Heading level override
Text Sizes
Body large
Body base
Body small
Overline
Label
Button
Caption
Mono medium
Mono small
Text Colors
Semantic Colors
Base Colors
Text Alignment
Font Weight
Bold Text
Medium Text
Text Transformation
Truncated Text
No Wrap Text
Combined Properties
Text with Interactive Elements
Text with Internationalization
Heading Hierarchy
Error Messages
Success Messages
Form Labels and Help Text