Saltar al contenido

Typography API

API documentation for the React Typography component. Learn about the available props, and the CSS API.

Import

import Typography from '@material-ui/core/Typography';
// or
import { Typography } from '@material-ui/core';
You can learn about the difference by reading this guide on minimizing bundle size.

Component name

The name MuiTypography can be used when providing default props or style overrides in the theme.

Props

NameTypeDefaultDescription
align'center'
| 'inherit'
| 'justify'
| 'left'
| 'right'
'inherit'Set the text-align on the component.
childrennodeThe content of the component.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
color'error'
| 'inherit'
| 'initial'
| 'primary'
| 'secondary'
| 'textPrimary'
| 'textSecondary'
'initial'The color of the component. It supports those theme colors that make sense for this component.
componentelementTypeThe component used for the root node. Either a string to use a HTML element or a component.
display'block'
| 'initial'
| 'inline'
'initial'Controls the display type
gutterBottomboolfalseIf true, the text will have a bottom margin.
noWrapboolfalseIf true, the text will not wrap, but instead will truncate with a text overflow ellipsis.
Note that text overflow can only happen with block or inline-block level elements (the element needs to have a width in order to overflow).
paragraphboolfalseIf true, the text will have a bottom margin.
variant'body1'
| 'body2'
| 'button'
| 'caption'
| 'h1'
| 'h2'
| 'h3'
| 'h4'
| 'h5'
| 'h6'
| 'inherit'
| 'overline'
| 'subtitle1'
| 'subtitle2'
| string
'body1'Applies the theme typography styles.
variantMappingobject{ h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4', h5: 'h5', h6: 'h6', subtitle1: 'h6', subtitle2: 'h6', body1: 'p', body2: 'p', inherit: 'p', }The component maps the variant prop to a range of different HTML 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 prop.

The ref is forwarded to the root element.
Any other props supplied will be provided to the root element (native element).

CSS

Rule nameGlobal classDescription
root.MuiTypography-rootStyles applied to the root element.
body2.MuiTypography-body2Styles applied to the root element if variant="body2".
body1.MuiTypography-body1Styles applied to the root element if variant="body1".
caption.MuiTypography-captionStyles applied to the root element if variant="caption".
button.MuiTypography-buttonStyles applied to the root element if variant="button".
h1.MuiTypography-h1Styles applied to the root element if variant="h1".
h2.MuiTypography-h2Styles applied to the root element if variant="h2".
h3.MuiTypography-h3Styles applied to the root element if variant="h3".
h4.MuiTypography-h4Styles applied to the root element if variant="h4".
h5.MuiTypography-h5Styles applied to the root element if variant="h5".
h6.MuiTypography-h6Styles applied to the root element if variant="h6".
subtitle1.MuiTypography-subtitle1Styles applied to the root element if variant="subtitle1".
subtitle2.MuiTypography-subtitle2Styles applied to the root element if variant="subtitle2".
overline.MuiTypography-overlineStyles applied to the root element if variant="overline".
inherit.MuiTypography-inheritStyles applied to the root element if variant="inherit".
alignLeft.MuiTypography-alignLeftStyles applied to the root element if align="left".
alignCenter.MuiTypography-alignCenterStyles applied to the root element if align="center".
alignRight.MuiTypography-alignRightStyles applied to the root element if align="right".
alignJustify.MuiTypography-alignJustifyStyles applied to the root element if align="justify".
noWrap.MuiTypography-noWrapStyles applied to the root element if nowrap={true}.
gutterBottom.MuiTypography-gutterBottomStyles applied to the root element if gutterBottom={true}.
paragraph.MuiTypography-paragraphStyles applied to the root element if paragraph={true}.
colorInherit.MuiTypography-colorInheritStyles applied to the root element if color="inherit".
colorPrimary.MuiTypography-colorPrimaryStyles applied to the root element if color="primary".
colorSecondary.MuiTypography-colorSecondaryStyles applied to the root element if color="secondary".
colorTextPrimary.MuiTypography-colorTextPrimaryStyles applied to the root element if color="textPrimary".
colorTextSecondary.MuiTypography-colorTextSecondaryStyles applied to the root element if color="textSecondary".
colorError.MuiTypography-colorErrorStyles applied to the root element if color="error".
displayInline.MuiTypography-displayInlineStyles applied to the root element if display="inline".
displayBlock.MuiTypography-displayBlockStyles applied to the root element if display="block".

You can override the style of the component using one of these customization options: If that isn't sufficient, you can check the implementation of the component for more detail.

Demos