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

CSS Specificity on Chip and Avatar #18246

Closed
2 tasks done
franklixuefei opened this issue Nov 7, 2019 · 1 comment
Closed
2 tasks done

CSS Specificity on Chip and Avatar #18246

franklixuefei opened this issue Nov 7, 2019 · 1 comment

Comments

@franklixuefei
Copy link
Contributor

franklixuefei commented Nov 7, 2019

Not able to override the default CSS rules applied to <Avatar> component inside of a <Chip>

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I tried to apply custom CSS rules to <Avatar> component that's consumed by the <Chip>, but my custom rules were overriden by the default rules.
image
image

Expected Behavior 🤔

My custom rules should win over the default rules.
image

Steps to Reproduce 🕹

Steps:
code:

     <Chip
        classes={{
          avatar: classes.avatar
        }}
        avatar={
          <Avatar className={classes.avatar}>
            <Typography>this is a long text</Typography>
          </Avatar>
        }
        label={'this is a label'}
      />
...
    avatar: {
      borderRadius: spacing(2),
      width: 'initial',
      padding: spacing(1)
    },
    // Note that if I specified "!important" after "initial", like "initial !important", it works.

Context 🔦

Note that it worked in v3.x

Your Environment 🌎

Tech Version
Material-UI v4.6.0
React latest
Browser
TypeScript latest
etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants