Files
react-test/docs/data/material/customization/typography/TypographyCustomVariant.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
841 B
JavaScript
Raw Normal View History

2025-12-12 14:26:25 +09:00
import { createTheme, ThemeProvider } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
const theme = createTheme({
typography: {
poster: {
fontSize: '4rem',
color: 'indianred',
},
// Disable v3 variant
h3: undefined,
},
components: {
MuiTypography: {
defaultProps: {
variantMapping: {
poster: 'h1', // map our new variant to render an <h1> by default
},
},
},
},
});
export default function TypographyCustomVariant() {
return (
<ThemeProvider theme={theme}>
<Box sx={{ '& > *': { display: 'block' } }}>
{/* @ts-ignore */}
<Typography variant="poster">poster</Typography>
<Typography variant="h3">h3</Typography>
</Box>
</ThemeProvider>
);
}