Overview
TheText component is a versatile typography component that automatically selects the appropriate semantic HTML element based on the type prop. It supports headers (h1-h6, d1), paragraphs (p, p2, c1, c2, o1, o2), and button text (b1, b2, b3).
Import
Usage
Headers
Paragraphs
Button Text
Custom Styling
Type Variants
Headers (d1, h1-h6)
Size: 52px (desktop), 48px (mobile)
Line Height: 64px (desktop), 60px (mobile)
Element:
Use case: Hero titles, largest display text
Line Height: 64px (desktop), 60px (mobile)
Element:
<h1>Use case: Hero titles, largest display text
Size: 48px (desktop), 32px (mobile)
Line Height: 56px (desktop), 40px (mobile)
Element:
Use case: Page titles
Line Height: 56px (desktop), 40px (mobile)
Element:
<h1>Use case: Page titles
Size: 40px (desktop), 28px (mobile)
Line Height: 48px (desktop), 36px (mobile)
Element:
Use case: Major section headings
Line Height: 48px (desktop), 36px (mobile)
Element:
<h2>Use case: Major section headings
Size: 28px (desktop), 24px (mobile)
Line Height: 36px (desktop), 32px (mobile)
Element:
Use case: Subsection headings
Line Height: 36px (desktop), 32px (mobile)
Element:
<h3>Use case: Subsection headings
Size: 24px (desktop), 20px (mobile)
Line Height: 32px (desktop), 28px (mobile)
Element:
Use case: Card titles, smaller headings
Line Height: 32px (desktop), 28px (mobile)
Element:
<h4>Use case: Card titles, smaller headings
Size: 20px (desktop), 18px (mobile)
Line Height: 28px (desktop), 26px (mobile)
Element:
Use case: Minor headings
Line Height: 28px (desktop), 26px (mobile)
Element:
<h5>Use case: Minor headings
Size: 18px (desktop), 16px (mobile)
Line Height: 26px (desktop), 24px (mobile)
Element:
Use case: Smallest headings
Line Height: 26px (desktop), 24px (mobile)
Element:
<h6>Use case: Smallest headings
Paragraphs (p, p2, c1, c2, o1, o2)
Size: 15px
Element:
Use case: Body text, main content
Element:
<p>Use case: Body text, main content
Size: 14px
Element:
Use case: Secondary body text
Element:
<p>Use case: Secondary body text
Size: 13px
Element:
Use case: Captions, helper text
Element:
<p>Use case: Captions, helper text
Size: 12px
Element:
Use case: Smaller captions, metadata
Element:
<p>Use case: Smaller captions, metadata
Size: 13px
Transform: Uppercase
Element:
Use case: Labels, category tags
Transform: Uppercase
Element:
<p>Use case: Labels, category tags
Size: 12px
Transform: Uppercase
Element:
Use case: Smaller labels, tags
Transform: Uppercase
Element:
<p>Use case: Smaller labels, tags
Button Text (b1, b2, b3)
Size: 18px (desktop), 15px (mobile)
Element:
Use case: Large button text
Element:
<p>Use case: Large button text
Size: 15px (desktop), 14px (mobile)
Element:
Use case: Standard button text
Element:
<p>Use case: Standard button text
Size: 13px
Element:
Use case: Small button text
Element:
<p>Use case: Small button text
Props
Typography variant to render. Determines the HTML element and default styles.Options:
"d1" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "p2" | "c1" | "c2" | "o1" | "o2" | "b1" | "b2" | "b3"Font weight variant.Options:
Default:
"regular" (400) | "medium" (500) | "semibold" (600)Default:
"regular"Custom inline styles to apply to the element.
Text content to display.
Features
- Automatic semantic HTML: Renders the appropriate element (
<h1>,<p>, etc.) based on type - Responsive typography: Headers automatically adjust size on mobile devices
- Flexible styling: Supports custom colors, weights, and additional styles
- Design system integration: Uses ColorV2 constants for consistent theming
- Accessible: Proper semantic elements for better accessibility
Best Practices
- Use header types (
h1-h6) for semantic document structure - Use
d1for large hero text that doesn’t need to be a semantic heading - Apply
weight="semibold"orweight="medium"for emphasis - Use overline types (
o1,o2) for labels and category indicators - Prefer ColorV2 constants over hardcoded colors for consistency
TextAnimated Component
The library also exports aTextAnimated component that cycles through an array of words with fade animations.
Import
Usage
Use{{data}} as a placeholder in the children string where you want the animated words to appear:
Props
All Text props are supported, plus:Array of strings to cycle through in the animation
Time in milliseconds between transitionsDefault: 2500
Animation
- Fades out current word with upward motion
- Fades in next word with downward motion
- Automatically cycles through options array
- Loops infinitely