AvatarGroup improvements
See original GitHub issueWe’d need to enhance the AvatarGroup
a bit by truncating its children. By default, we would display a maximum of 4
avatars. If there is an avatars
prop passed in with length > 4
, the last element is replaced with a circle in the primary color, containing +${avatar.length -3}
that invokes whatever the onMoreClick
prop tells it to.
Proposed API
<AvatarGroup
avatars={[]}
renderTooltip={avatar => <>{avatar.name}</>}
onMoreClick={() => doSomething()}
/>
What happens onClick of an Avatar?
Nothing, for now.
What happens onMouseEnter of an Avatar?
We display whatever the renderTooltip
says.
What happens onClick of (+5)?
We do whatever onMoreClick
says.
Should the list expand?
No.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
[Avatar] Customize the last avatar in a group #23849 - GitHub
@cngeru You need to target all the Avatars (the +2 is renderered by AvatarGroup):. import React from "react"; import { makeStyles } from ......
Read more >AvatarGroup API - Material UI - MUI
API reference docs for the React AvatarGroup component. Learn about the props, CSS, and other APIs of this exported module.
Read more >Vaadin 18 brings enhancements for Fusion and Flow
Read the enhancements for Fusion and Flow included in the release. ... The new Avatar and AvatarGroup components display the user's avatar ...
Read more >AVATAR Group (@AVATAR_grp) / Twitter
Opportunities for improved CVAD management practices, presented by Dr Amanda Corley. “Do the simple things, and do them well…easier said than done” #ACIPC22....
Read more >React Avatar Component - PrimeFaces
AvatarGroup. A set of Avatars can be displayed together using the AvatarGroup component. <AvatarGroup> <Avatar label="P" /> <Avatar icon="pi pi-search" ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I like it! - that’s what I had in mind 😃
I think hardcoding is flawed by design and ought to be avoided. If we want to provide a good, opinionated set of UI components, I think we ought to provide reasonable defaults with allowing a user to override it to suit whatever his/her use case or design may require.
This would mean
avatarCount
is a prop that defaults to3
but can be overridden to whatever the user wants.How does that sound?