Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[styled] theme style overrides is overridden by variants #55

Closed
siriwatknp opened this issue May 8, 2024 · 0 comments · Fixed by #56
Closed

[styled] theme style overrides is overridden by variants #55

siriwatknp opened this issue May 8, 2024 · 0 comments · Fixed by #56
Assignees
Labels
bug 🐛 Something doesn't work

Comments

@siriwatknp
Copy link
Member

siriwatknp commented May 8, 2024

Steps to reproduce

Take a look at a74419e.

Current behavior

The styles defined in theme.styleOverrides (without variants) are overridden by the Component's variants.

const OutlinedInputInput = styled('input', {
  name: 'MuiOutlinedInput',
  slot: 'Input',
})({
  padding: '16.5px 14px',
  variants: [
    {
      props: {
        size: 'small',
      },
      style: {
        padding: '8.5px 14px',
      },
    },
    {
      props: ({ ownerState }) => ownerState.multiline,
      style: {
        padding: 0,
      },
    },
    {
      props: ({ ownerState }) => ownerState.startAdornment,
      style: {
        paddingLeft: 0,
      },
    },
    {
      props: ({ ownerState }) => ownerState.endAdornment,
      style: {
        paddingRight: 0,
      },
    },
  ],
});

// theme
{
  themeArgs: {
    theme: {
      components: {
        MuiOutlinedInput: {
          styleOverrides: {
            input: {
              paddingLeft: 10,
            },
          },
        },
      },
    },
  },
}

See the generated CSS

Expected behavior

The generated CSS of theme.styleOverrides should come last.

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: overrides

@siriwatknp siriwatknp added status: waiting for maintainer These issues haven't been looked at yet by a maintainer bug 🐛 Something doesn't work and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 8, 2024
brijeshb42 added a commit to brijeshb42/pigment-css that referenced this issue May 8, 2024
brijeshb42 added a commit to brijeshb42/pigment-css that referenced this issue May 8, 2024
brijeshb42 added a commit to brijeshb42/pigment-css that referenced this issue May 8, 2024
brijeshb42 added a commit to brijeshb42/pigment-css that referenced this issue May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants