/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/data/material/customization/typography/TypographyCustomVariant.js
35 строк
841 B
Brijesh Bittu
[code-infra] Remove React import requirement for jsx (#47146)
29 окт 2025, 20:55
Не верифицирован
29 окт 2025, 20:55
6c9e82f
Код
Авторство
О чём код?
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> ); }