-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Avatar] Set background colour for AvatarGroup's borders #21700
Comments
@WillSquire I have noticed that facebook.com uses a clip logic to solve this problem. However, I'm not sure about the added complexity. I don't see any clear solution out of this. The I have also noticed that the box model is wrong. We should change it: diff --git a/packages/material-ui-lab/src/AvatarGroup/AvatarGroup.js b/packages/material-ui-lab/src/AvatarGroup/AvatarGroup.js
index 89ef01ac9..3716f65df 100644
--- a/packages/material-ui-lab/src/AvatarGroup/AvatarGroup.js
+++ b/packages/material-ui-lab/src/AvatarGroup/AvatarGroup.js
@@ -20,6 +20,7 @@ export const styles = (theme) => ({
/* Styles applied to the avatar elements. */
avatar: {
border: `2px solid ${theme.palette.background.default}`,
+ boxSizing: 'content-box',
marginLeft: -8,
'&:last-child': {
marginLeft: 0, |
@oliviertassinari Thanks for getting back so fast. I'm racking my brains for a hands-off solution, but I think that could be clean for now. Would you like me to have a try with a pull request? Also noticed |
I don't see any great solution for this:
Yeah, let's go with this. |
Adding the "good first issue" label so we fix the box-sizing: #21700 (comment). Outside of this, I doubt we can improve the tradeoff, if not by making it easier to style the border color, which we plan in #15561. |
Summary 💡
Avatar group uses the background colour set for the app for the Avatar borders, but doesn't pick up on the background colour of the div it's within.
Examples 🌈
Solution could be to either have a property to set the border colour:
or to wrap each one in a div that inherits the background colour from a parent. Giving a more hands-off approach.
Motivation 🔦
Used it on a different background and expected it to work without overriding colour.
The text was updated successfully, but these errors were encountered: