Typography
Express semantic text elements independently from visual theme variants.
This guide covers Material UI Core with the default Emotion engine; extensions and additional demos are explicitly classified.
Use case and business boundary
A visual h1 variant is not necessarily an h1 element; preserve document hierarchy and readable responsive wrapping.
Native composition and scope
Typography
Preserve native Material UI composition and types; do not substitute JGuang UI/Base UI/Radix APIs. Example entries are not extra components.
Native installation and initialization
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1
Use native npm and Emotion, not an invented JGuang UI Registry URL. Place examples inside native ThemeProvider; choose CssBaseline or ScopedCssBaseline for the project. Inspect React, existing providers, lockfile and SSR first. Never overwrite files or conceal peer conflicts. This batch verified React 19.2.8; React 18 and below require matching react-is. See the included bilingual setup guide.
Practical native parameters
These selected parameters are not a flattened universal API. Preserve the native declaring owner, slot structure, nullable values and generics.
| Owner.prop | Practical role | Declaration source |
|---|---|---|
Typography.variant | Owning native presentation enum; never substitute a universal variant prop. | Typography |
Typography.component | Rendered native element/component type; preserve valid semantics and refs. | Typography |
Typography.variantMapping | Map Typography visual variants to semantic elements. | Typography |
Typography.noWrap | Use single-line text overflow styling; not a responsive content strategy. | Typography |
Runnable native examples
Machine keys select example entries, not universal variant props. Native demo JSX/data stay unchanged; JGuang-authored acceptance fixtures are explicitly labelled.
- Usage ·
Types· upstream native demo - Theme keys ·
TypographyTheme· upstream native demo
Actual usage example
Unmodified pinned native demo; copy its required local helper files together.
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
export default function Types() {
return (
<Box sx={{ width: '100%', maxWidth: 500 }}>
<Typography variant="h1" gutterBottom>
h1. Heading
</Typography>
<Typography variant="h2" gutterBottom>
h2. Heading
</Typography>
<Typography variant="h3" gutterBottom>
h3. Heading
</Typography>
<Typography variant="h4" gutterBottom>
h4. Heading
</Typography>
<Typography variant="h5" gutterBottom>
h5. Heading
</Typography>
<Typography variant="h6" gutterBottom>
h6. Heading
</Typography>
<Typography variant="subtitle1" gutterBottom>
subtitle1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
blanditiis tenetur
</Typography>
<Typography variant="subtitle2" gutterBottom>
subtitle2. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
blanditiis tenetur
</Typography>
<Typography variant="body1" gutterBottom>
body1. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur,
neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum
quasi quidem quibusdam.
</Typography>
<Typography variant="body2" gutterBottom>
body2. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur,
neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti? Eum
quasi quidem quibusdam.
</Typography>
<Typography variant="button" gutterBottom sx={{ display: 'block' }}>
button text
</Typography>
<Typography variant="caption" gutterBottom sx={{ display: 'block' }}>
caption text
</Typography>
<Typography variant="overline" gutterBottom sx={{ display: 'block' }}>
overline text
</Typography>
</Box>
);
}
Example dependency boundaries
@mui/material/Box, @mui/material/Typography, @mui/material/styles
Direct Icons/System/Utils example imports require their matching 9.4.0 packages. Relative data/helpers are part of the example closure, not extra components. Remote images and simulated operations do not supply a backend.
Pinned upstream API metadata reference
These tables retain the upstream metadata, not a newly inferred generic type system. Conditional generics, inherited props and callback details are defined by the source declarations below. Theme defaults may override metadata defaults.
Typography
import Typography from '@mui/material/Typography';
import { Typography } from '@mui/material';
| Prop | Required | Upstream metadata type / constraint | Metadata default |
|---|---|---|---|
align | no | 'center' | 'inherit' | 'justify' | 'left' | 'right' | 'inherit' |
children | no | node | — |
classes | no | object | — |
color | no | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning' | 'textPrimary' | 'textSecondary' | 'textDisabled' | string | — |
component | no | elementType | — |
gutterBottom | no | bool | false |
noWrap | no | bool | false |
sx | no | Array<func | object | bool> | func | object | — |
variant | no | 'body1' | 'body2' | 'button' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'inherit' | 'overline' | 'subtitle1' | 'subtitle2' | string | 'body1' |
variantMapping | no | object | { h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4', h5: 'h5', h6: 'h6', subtitle1: 'h6', subtitle2: 'h6', body1: 'p', body2: 'p', inherit: 'p', } |
Native source declarations
Declarations/imports are extracted from pinned source without flattening unions or external inheritance. Original English comments/types are source reference, not a claim of translated upstream prose. Shared types stay in their native packages.
vendor/src/Typography/Typography.d.ts
import * as React from 'react';
import { OverridableStringUnion } from '@mui/types';
import { SxProps } from '@mui/system';
import { Theme, TypeText } from '../styles';
import { OverrideProps, OverridableComponent } from '../OverridableComponent';
import { TypographyVariant } from '../styles/createTypography';
import { TypographyClasses } from './typographyClasses';
export interface TypographyPropsVariantOverrides {}
export interface TypographyPropsColorOverrides {}
export interface TypographyOwnProps {
/**
* Set the text-align on the component.
* @default 'inherit'
*/
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify' | undefined;
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<TypographyClasses> | undefined;
/**
* The color of the component.
* It supports both default and custom theme colors, which can be added as shown in the
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
*/
color?:
| OverridableStringUnion<
| 'primary'
| 'secondary'
| 'success'
| 'error'
| 'info'
| 'warning'
| `text${Capitalize<keyof TypeText>}`,
TypographyPropsColorOverrides
>
| (string & {})
| undefined;
/**
* If `true`, the text will have a bottom margin.
* @default false
*/
gutterBottom?: boolean | undefined;
/**
* If `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).
* @default false
*/
noWrap?: boolean | undefined;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme> | undefined;
/**
* Applies the theme typography styles.
* @default 'body1'
*/
variant?:
| OverridableStringUnion<TypographyVariant | 'inherit', TypographyPropsVariantOverrides>
| undefined;
/**
* 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.
* @default {
* h1: 'h1',
* h2: 'h2',
* h3: 'h3',
* h4: 'h4',
* h5: 'h5',
* h6: 'h6',
* subtitle1: 'h6',
* subtitle2: 'h6',
* body1: 'p',
* body2: 'p',
* inherit: 'p',
* }
*/
variantMapping?:
| Partial<
Record<
OverridableStringUnion<TypographyVariant | 'inherit', TypographyPropsVariantOverrides>,
string
>
>
| undefined;
}
export interface TypographyTypeMap<
AdditionalProps = {},
RootComponent extends React.ElementType = 'span',
> {
props: AdditionalProps & TypographyOwnProps;
defaultComponent: RootComponent;
}
declare const Typography: OverridableComponent<TypographyTypeMap>;
export type TypographyProps<
RootComponent extends React.ElementType = TypographyTypeMap['defaultComponent'],
AdditionalProps = {},
> = OverrideProps<TypographyTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType | undefined;
};
Post-install acceptance
Run strict types, production build and real interactions. Check keyboard labels/focus, disabled/error/read-only semantics where natively supported, both themes, narrow screens and reduced motion. Verify callbacks against the real host data; do not declare installation complete from copying a prompt. Initialization fixtures also require server HTML and warning-free hydration.
Source and license
https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e
MIT · @mui/material@9.4.0. Vendor originals and license are preserved. Full original upstream prose remains in vendor/docs and is not represented as fully translated.