question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[AvatarGroup] Add a prop for configuring the overlap

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

Here’s a mockup from the PR:

There should be some way to specify which direction the AvatarGroup overlaps/cascades its items.

Examples 🌈

Other Implementations

This component is on react-ui-roundup if looking at other implementations is helpful:

Motivation 🔦

I am working with a design that utilizes AvatarGroup, but the design requires the groups to cascade above each other, rather than below. It seems reasonable to me that a prop for this should exist to configure this.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
siriwatknpcommented, Feb 28, 2022

@dimitropoulos You can use this snippet as a workaround.

<ThemeProvider
  theme={createTheme({
    components: {
      MuiAvatarGroup: {
        styleOverrides: {
          root: ({ ownerState: { max } }) => ({
            ...[...Array(max)].reduce(
              (result, curr, index) => ({
                ...result,
                [`& > .MuiAvatar-root:nth-child(${index + 1})`]: {
                  zIndex: max - index
                }
              }),
              {}
            )
          })
        }
      }
    }
  })}
>

https://codesandbox.io/s/groupavatars-material-demo-forked-vcfufi?file=/demo.tsx

1reaction
mnajdovacommented, Jan 26, 2022

In my opinion, I would wait for upvotes 👍. This is something that can be implemented in userland with theme overrides with just few lines of code. So far, we didn’t have request for this, so I am not sure if many developers would benefit from this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[AvatarGroup] Add a prop for configuring the overlap #30789
I am working with a design that utilizes AvatarGroup , but the design requires the groups to cascade above each other, rather than...
Read more >
Avatar | Components - BootstrapVue
You can control the overlap amount by setting the overlap prop to a value between 0 and 1 , where 0 means no...
Read more >
Avatar - Chakra UI
To adjust the spacing between the avatars, pass the spacing prop. +3 Segun Adebayo Ryan Florence. <AvatarGroup size='md' ...
Read more >
AvatarGroup API - Material UI - MUI
API reference docs for the React AvatarGroup component. Learn about the props, CSS, and other APIs ... You can override the existing props...
Read more >
sap.f.AvatarGroup - API Reference - Demo Kit - SAPUI5 SDK
Group type: The avatars are displayed as partially overlapped on top of each ... It takes effect only if the avatarDisplaySize property is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found