#Can I use sx prop to change the default style without !important?

6 messages · Page 1 of 1 (latest)

iron flint
#

eg. I want to change the font-size of Anchor comp to 10px using sx prop

<Anchor
  ...
  sx={{ zIndex: 999, fontSize: '10px !important' }} // it works!
  sx={{ zIndex: 999, fontSize: '10px' }}            // it does not work!

  // these two will definitely work, but I'm talking sx prop
  fz={10} 
  style={{fontSize: '10px'}}
>Some Text</Anchor>

it will generate:

.mantine-1mpdrlu { // works one.
    font-size: 10px!important;
    font-size: 1rem;
}

.mantine-1mpdrlu { // not works one.
    font-size: 10px;
    font-size: 1rem;
}

Is there a priority for sx prop and style prop? It looks like style prop has a higher priority?

#

btw I'm using v6

#

Can I use sx prop to change the default style without !important?

vague birch
iron flint
#
GitHub

React components library with native dark theme support - mantine/Anchor.tsx at v6 · mantinedev/mantine

GitHub

React components library with native dark theme support - mantine/Text.tsx at v6 · mantinedev/mantine

GitHub

React components library with native dark theme support - mantine/Button.tsx at v6 · mantinedev/mantine

vague birch