viclafouch / mui-color-input

📌 A color input designed for MUI (Material ui) V6 built with TinyColor
https://viclafouch.github.io/mui-color-input/
60 stars 20 forks source link

Add default values for ColorButton in case theme does not use the defaults #35

Closed chrisapplegate closed 2 months ago

chrisapplegate commented 3 months ago

Hi there - big fan of this component. However, it glitches a little bit visually in my custom MUI theme, see below:

ezgif-4-a3e1575fba

The reason for this is my custom theme, I have forced default values for Button's variant and disableElevation props to be different from the MUI defaults, namely:

export const MuiButton = {
  defaultProps: {
    variant: "outlined",
    disableElevation: true,
  },
...

But the ColorButton component in this package assumes the default props for Button are the same as MUI's. Therefore to fix this I have added in the props to force it to always have variant="text" and disableElevation={false}, so it is always the same as the MUI default props even if a custom theme has been applied.