[theme] Allow custom typography variants
See original GitHub issueMUI allows you to add custom keys to the theme configuration. However, there is no way to expand the design system unless you create a whole new component. Allowing MUI components to reference custom theme keys would bring customization to a whole nother level.
createMuiTheme({
typography: {
poster: {
fontSize: '5.8rem'
},
},
});
Usage:
<Typography variant="poster">Super big headline</Typography>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:20
- Comments:23 (10 by maintainers)
Top Results From Across the Web
How To Add Custom Typography Variants In Material UI v5.1.0
While doing project at company I am working I came across with problem, where I need it to add extra Typography variant.
Read more >Typography - Material UI - MUI
The theme.typography.* variant properties map directly to the generated CSS. You can use media queries inside them: const theme = createTheme() ...
Read more >How to add custom typography variants in React material UI
First, create a default theme object using the createTheme method and include your own custom variants inside the typography object. import { ...
Read more >MUI v5 - Extending Typography variant in TypeScript creates ...
I want to extend the MUI theme with some custom properties which add to the existing default properties. My theme.ts config looks like...
Read more >Variants - Theme UI
To add groups of styles based on theme values, you can take advantage of the Variants feature. Variants allow you to define the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have fixed the underlying technical issue in #23841. Now, developers can do 🎉:
https://codesandbox.io/s/fontsizetheme-material-demo-forked-l9u05?file=/demo.tsx
I believe the last step is to properly document it. Maybe inside https://next.material-ui.com/customization/typography/? @mnajdova
if someone wants to do this in V4, you can wrap the Material UI component with some of your own variants:
then using the typography component above, you can use your own variants:
not as nice as being able to define in the theme, but it works 🤷