Skip to main content
The Text component is a versatile typography primitive that supports multiple variants, sizes, weights, and text styling options. It can render as different HTML elements while maintaining consistent styling.

Basic usage

Props

'primary' | 'secondary' | 'tertiary' | 'emphasis' | 'accent' | 'attention' | 'danger' | 'success'
default:"'primary'"
Visual style variant that conveys semantic meaning through color.
'micro' | 'mini' | 'small' | 'regular' | 'large' | 1-10
default:"'small'"
Text size. Use named sizes (‘micro’, ‘mini’, ‘small’, ‘regular’, ‘large’) for recommended options.
'regular' | 'medium' | 'bold' | 'bolder' | 'normal' | 'lighter' | 100-900
default:"'regular'"
Font weight. Use ‘regular’ or ‘medium’ for recommended options.
'capitalize' | 'uppercase' | 'lowercase'
Text transformation.
'center' | 'start' | 'end' | 'justify'
Text alignment.
1 | 2 | 3 | 4 | 5
Limit text to specified number of lines with ellipsis.
boolean
Whether to underline the text.
boolean
Whether to add strikethrough styling.
boolean
Whether to italicize the text.
'span' | 'div' | 'p' | 'label' | 'a'
default:"'span'"
The HTML element to render.
string
Additional CSS classes to apply.
ReactNode
The text content.

Variants

Different semantic color styles for various use cases.

Sizes

Use named sizes for consistent typography.

Font weights

Text transformations

Text alignment

Line clamping

Limit text to a specific number of lines with ellipsis.

Text styling

HTML elements

Render as different HTML elements while maintaining styling.

Status messages

With other components

Text works well as a wrapper for inline components.

Accessibility

  • Use semantic HTML elements via the as prop for proper document structure
  • Ensure sufficient color contrast between text and background
  • Use appropriate variant colors that convey semantic meaning
  • When using line clamping, consider providing a way to view the full text
  • Headline - For larger headings and titles
  • Link - Extends Text with link functionality
  • Amount - Inherits Text styling for monetary values
  • Label - For form field labels