Skip to content

Typography API

The API documentation of the Typography React component. Learn more about the properties and the CSS customization points.

import Typography from '@material-ui/core/Typography';

Props

Name Type Default Description
align enum: '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. See CSS API below for more details.
color enum: 'initial', 'inherit', 'primary', 'secondary', 'textPrimary', 'textSecondary', 'error'
'initial' The color of the component. It supports those theme colors that make sense for this component.
component elementType The component used for the root node. Either a string to use a DOM element or a component. By default, it maps the variant to a good default headline component.
display enum: 'initial' |
 'block' |
 'inline'
'initial' Controls the display type
gutterBottom bool false If true, the text will have a bottom margin.
noWrap bool false If true, the text will not wrap, but instead will truncate with an ellipsis.
paragraph bool false If true, the text will have a bottom margin.
variant enum: 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'caption', 'button', 'overline', 'srOnly', 'inherit'
'body1' Applies the theme typography styles.
variantMapping object { h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4', h5: 'h5', h6: 'h6', subtitle1: 'h6', subtitle2: 'h6', body1: 'p', body2: 'p',} We are empirically mapping the variant property to a range of different DOM element types. For instance, subtitle1 to <h6>. If you wish to change that mapping, you can provide your own. Alternatively, you can use the component property.

The ref is forwarded to the root element.

Any other properties supplied will be provided to the root element (native element).

CSS

You can override all the class names injected by Material-UI thanks to the classes property. This property accepts the following keys:

Name Description
root Styles applied to the root element.
body2 Styles applied to the root element if variant="body2".
body1 Styles applied to the root element if variant="body1".
caption Styles applied to the root element if variant="caption".
button Styles applied to the root element if variant="button".
h1 Styles applied to the root element if variant="h1".
h2 Styles applied to the root element if variant="h2".
h3 Styles applied to the root element if variant="h3".
h4 Styles applied to the root element if variant="h4".
h5 Styles applied to the root element if variant="h5".
h6 Styles applied to the root element if variant="h6".
subtitle1 Styles applied to the root element if variant="subtitle1".
subtitle2 Styles applied to the root element if variant="subtitle2".
overline Styles applied to the root element if variant="overline".
srOnly Styles applied to the root element if variant="srOnly". Only accessible to screen readers.
alignLeft Styles applied to the root element if align="left".
alignCenter Styles applied to the root element if align="center".
alignRight Styles applied to the root element if align="right".
alignJustify Styles applied to the root element if align="justify".
noWrap Styles applied to the root element if align="nowrap".
gutterBottom Styles applied to the root element if gutterBottom={true}.
paragraph Styles applied to the root element if paragraph={true}.
colorInherit Styles applied to the root element if color="inherit".
colorPrimary Styles applied to the root element if color="primary".
colorSecondary Styles applied to the root element if color="secondary".
colorTextPrimary Styles applied to the root element if color="textPrimary".
colorTextSecondary Styles applied to the root element if color="textSecondary".
colorError Styles applied to the root element if color="error".
displayInline Styles applied to the root element if display="inline".
displayBlock Styles applied to the root element if display="block".

Have a look at the overriding styles with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiTypography.

Notes

The component is fully StrictMode compatible.

Demos