Files
react-test/docs/data/material/customization/typography/TypographyCustomVariant.tsx
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00

38 lines
883 B
TypeScript

import { createTheme, ThemeProvider } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
const theme = createTheme({
typography: {
// @ts-ignore
poster: {
fontSize: '4rem',
color: 'indianred',
},
// Disable v3 variant
h3: undefined,
},
components: {
MuiTypography: {
defaultProps: {
variantMapping: {
// @ts-ignore
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>
);
}