Reusable React Email text component with typography variants, weights, alignment, and optional margin control for consistent email body copy.
// Source: https://github.com/polarsource/polar | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import { Text as ReactEmailText } from 'react-email'
type TextVariant = 'body' | 'lead' | 'caption' | 'footnote' | 'mono' | 'detail'
type TextWeight = 'normal' | 'medium' | 'semibold' | 'bold'
type TextAlign = 'left' | 'center' | 'right'
interface TextProps {
children: React.ReactNode
variant?: TextVariant
weight?: TextWeight
align?: TextAlign
as?: 'p' | 'span'
noMargin?: boolean
}
const variantClasses: Record<TextVariant, string> = {
body: 'text-[16px] leading-[24px]',
lead: 'text-[18px] leading-[28px]',
caption: 'text-[14px] leading-[20px] text-gray-500',
footno
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key