Home > Mobile >  How to style children divs
How to style children divs

Time:11-01

Really simple problem, but I cant find a solution. How would I be able to style both of the typography components without having to repeat the tailwind styling on each line, I try to put the stying in the "parent" div but it wont work. Thanks in advance. This is for a React-app

<div className="parent">
    <Typography variant='Title' text={Company} classes="py-2 px-15 rounded-5" />
    <Typography variant='SubTitle' text={City} classes="py-2 px-15 rounded-5" />
</div>

CodePudding user response:

You can use classes. classes is an object

Use mui css properties inside classes object

<Typography
    classes={
        root: 'custom-class',
    }
>
...
</Typography>
  • Related