Overview
TheText component provides a flexible way to render text content with semantic variants that automatically map to appropriate HTML elements. It supports size overrides, bold text, and muted styling.
Import
Basic Usage
Variants
Thevariant prop determines both the semantic HTML element and visual styling:
Variant Mappings
| Variant | Element | Styling |
|---|---|---|
display | h1 | text-4xl font-bold tracking-tight |
heading | h2 | text-2xl font-semibold tracking-tight |
label | label | text-sm font-medium |
body | p | text-base leading-relaxed |
caption | span | text-xs text-muted-foreground |
Size Override
Override the default variant size:Available Sizes
xs-text-xssm-text-smmd-text-baselg-text-lgxl-text-xl2xl-text-2xl3xl-text-3xl4xl-text-4xl
Bold Text
Muted Text
Appliestext-muted-foreground for secondary text:
Custom Element
Override the default element mapping:Examples
Article Header
Form Label
Large Bold Text
Props
Semantic text variant that determines default element and styling
Override the default variant size
Apply bold font weight
Apply muted foreground color for secondary text
Override the default HTML element (defaults based on variant)
Additional CSS classes
Text content to render
Type Definition
Source:/home/daytona/workspace/source/src/components/typography/Text.tsx:49