I had a question regarding breakpoints when dealing with responsiveness. I’m using Material UI, which has breakpoints at which you can enable different CSS styles. These are predefined, like xs, xl, md, etc.. I want to set breakpoints at custom pixel values. Is there any way to do this easily within a component without modifying theme?
If this can’t be done, what is a good alternative without changing the theme?
2
Answers
you can create another theme with the same values of the previous one if needed but with the updated
breakpoints
property and use it wherever you want you just have to wrapp what you want within it for example:dont forget to import
createMuiTheme
andThemeProvider
from mui.You can use two approaches for custom breakpoints without changing the MUI theme.
Pass an inline breakpoint value. e.g. 👇
Create a reusable custom breakpoint object. e.g. 👇