0

material-uiアルファ版でstyled-componentsを使用しようとしています

documentationによると、これはそのままで動作するはずです。

このコード:

const StyledButton = styled(Button)`
   color: red;
   text-transform: uppercase;
`;

return <StyledButton>Button</StyledButton>;

次のようなものが生成されます。

<button tabindex="0" class="MuiButtonBase-root-3177716317 sc-bdVaJa sxRGN" type="button" role="button">
...
</button>

よさそうです。

ただし、私が抱えている唯一の問題は、挿入された CSS スタイル( pic ) の順序です。styled-components からのスタイルは、MUI のスタイルの前に挿入されるため、優先度が低くなります。

を使用せずにこれを解決する方法はあります!importantか?

4

3 に答える 3