Introduction
The Typography component helps you apply the Material Design type scale to your text. It provides a set of pre-defined text styles that follow Material Design guidelines, making it easy to maintain consistent typography throughout your application.Basic Usage
Variants
The Typography component uses thevariant prop to apply different text styles. Each variant maps to a specific HTML element and typographic style.
Component
The Typography component uses thevariantMapping to associate a UI variant with a semantic element. However, you can override this mapping using the component prop.
Color
Thecolor prop supports theme palette colors and custom colors.
Alignment
Use thealign prop to control text alignment.
Gutters
Use thegutterBottom prop to add bottom margin.
No Wrap
Use thenoWrap prop to prevent text wrapping and show ellipsis for overflow.
System Props
Typography supports all system props for quick customization.Responsive Typography
You can make typography responsive using theme breakpoints.Theme Typography
You can customize the typography system in your theme:Adding Custom Variants
You can add custom typography variants to your theme:Props
Typography Props
| Prop | Type | Default | Description |
|---|---|---|---|
align | 'inherit' | 'left' | 'center' | 'right' | 'justify' | 'inherit' | Set the text-align on the component. |
children | node | - | The content of the component. |
classes | object | - | Override or extend the styles applied to the component. |
color | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning' | 'textPrimary' | 'textSecondary' | 'textDisabled' | string | - | The color of the component. Supports theme colors. |
gutterBottom | boolean | false | If true, the text will have a bottom margin. |
noWrap | boolean | false | If true, text will not wrap and will truncate with ellipsis. |
paragraph | boolean | false | Deprecated. If true, element will be a paragraph. Use component="p" instead. |
sx | SxProps<Theme> | - | The system prop for defining CSS overrides and additional styles. |
variant | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'button' | 'overline' | 'inherit' | 'body1' | Applies the theme typography styles. |
variantMapping | object | See default mapping | The component maps the variant prop to a range of different HTML elements. Override with this prop. |
Default Variant Mapping
CSS Classes
The following CSS classes are available for customization:.MuiTypography-root- Styles applied to the root element..MuiTypography-h1- Styles applied ifvariant="h1"..MuiTypography-h2- Styles applied ifvariant="h2"..MuiTypography-h3- Styles applied ifvariant="h3"..MuiTypography-h4- Styles applied ifvariant="h4"..MuiTypography-h5- Styles applied ifvariant="h5"..MuiTypography-h6- Styles applied ifvariant="h6"..MuiTypography-subtitle1- Styles applied ifvariant="subtitle1"..MuiTypography-subtitle2- Styles applied ifvariant="subtitle2"..MuiTypography-body1- Styles applied ifvariant="body1"..MuiTypography-body2- Styles applied ifvariant="body2"..MuiTypography-caption- Styles applied ifvariant="caption"..MuiTypography-button- Styles applied ifvariant="button"..MuiTypography-overline- Styles applied ifvariant="overline"..MuiTypography-inherit- Styles applied ifvariant="inherit"..MuiTypography-alignLeft- Styles applied ifalign="left"..MuiTypography-alignCenter- Styles applied ifalign="center"..MuiTypography-alignRight- Styles applied ifalign="right"..MuiTypography-alignJustify- Styles applied ifalign="justify"..MuiTypography-noWrap- Styles applied ifnoWrap={true}..MuiTypography-gutterBottom- Styles applied ifgutterBottom={true}..MuiTypography-paragraph- Styles applied ifparagraph={true}.