Typography
Utilities for controlling typography with theme integration.Import
API
Fromtypography/typography.js:46-56:
Font Family
Set the font family with theme integration:typography.js:4-7:
Font Size
Control font size with theme values:typography.js:9-12:
Font Style
Set font style:typography.js:14-17:
Font Weight
Control font weight:typography.js:19-22:
Letter Spacing
Control letter spacing:typography.js:24-26:
Line Height
Control line height:typography.js:32-34:
Text Align
Align text:typography.js:36-38:
Text Transform
Transform text:typography.js:28-30:
Typography Variant
Apply complete typography variant from theme:typography.js:40-44:
Theme Typography Structure
Common Patterns
Heading Styles
Body Text
Caption and Label
Custom Typography
Responsive Font Size
Text Alignment
Emphasized Text
Quote Block
Code Text
Button Text
Card Title and Description
Font Weight Scale
Custom Font Family
With sx Prop
TypeScript
Available Properties
| Prop | CSS Property | Theme Key | Example Values |
|---|---|---|---|
fontFamily | font-family | typography | 'default', 'monospace', 'h1.fontFamily' |
fontSize | font-size | typography | 12, '1rem', 'h1.fontSize' |
fontStyle | font-style | typography | 'normal', 'italic', 'oblique' |
fontWeight | font-weight | typography | 'light', 'regular', 'medium', 'bold', 400, 700 |
letterSpacing | letter-spacing | - | 0.5, '0.1em', '-0.5px' |
lineHeight | line-height | - | 1.5, '1.6', '24px' |
textAlign | text-align | - | 'left', 'center', 'right', 'justify' |
textTransform | text-transform | - | 'none', 'capitalize', 'uppercase', 'lowercase' |
typography | Multiple | typography | 'h1', 'h2', 'body1', 'body2', 'caption' |
Typography Variants
Default theme typography variants:- h1 - Largest heading (96px, light)
- h2 - Second level heading (60px, light)
- h3 - Third level heading (48px, regular)
- h4 - Fourth level heading (34px, regular)
- h5 - Fifth level heading (24px, regular)
- h6 - Sixth level heading (20px, medium)
- subtitle1 - Subtitle text (16px, regular)
- subtitle2 - Smaller subtitle (14px, medium)
- body1 - Default body text (16px, regular)
- body2 - Secondary body text (14px, regular)
- button - Button text (14px, medium, uppercase)
- caption - Small text (12px, regular)
- overline - Small uppercase text (12px, regular, uppercase)
Best Practices
- Use typography variants - Leverage theme variants for consistency
- Semantic HTML - Use appropriate HTML elements with
componentprop - Responsive sizing - Adjust font sizes for different breakpoints
- Readable line height - Use 1.5+ for body text
- Contrast - Ensure sufficient color contrast
- Font loading - Optimize web font loading
Related
- Box Component - Using typography with Box
- Palette - Text color utilities
- sx Prop - Advanced typography styling