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

Allow the option to format the value of extraAvatars in AvatarGroup #39204

Open
2 tasks done
NaamanTsur opened this issue Sep 28, 2023 · 3 comments
Open
2 tasks done

Allow the option to format the value of extraAvatars in AvatarGroup #39204

NaamanTsur opened this issue Sep 28, 2023 · 3 comments
Assignees
Labels
component: avatar This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material

Comments

@NaamanTsur
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

I am using the AvatarGroup component with the total prop. In my case, the total is a very large number (in the thousands) so I want to format it so it would look like this: 4K instead of +4012.

The solution can be in the form of a formatter prop which accepts the number and returns the formatted value.

Examples 🌈

No response

Motivation 🔦

The lack of this feature causes me to implement the total prop logic by myself, which is unfortunate considering the only thing I need is formatting the value.

@NaamanTsur NaamanTsur added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Sep 28, 2023
@zannager zannager added the component: avatar This is the name of the generic UI component, not the React module! label Sep 28, 2023
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Oct 1, 2023
@sujalcodes3
Copy link

Can you please describe the feature that you want in detail. if you can show an example of your total prop logic. @NaamanTsur

@siriwatknp siriwatknp added enhancement This is not a bug, nor a new feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 2, 2023
@siriwatknp
Copy link
Member

I think the extraAvatar element should be customizable. I see 2 options:

  • [non-breaking change] adding a new prop called renderSurplus: (surplus: number) => React.ReactElement to let developer control the text.
  • [breaking] Follow Joy and deprecate the total and max props.

cc @DiegoAndai

@DiegoAndai
Copy link
Member

DiegoAndai commented Oct 3, 2023

@siriwatknp for v5, the non-breaking change option is the only viable one, so we should go with that one if we want to support this use case.

for v6, we can contemplate following Joy 👍🏼 I will write it down so we remember

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: avatar This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature package: material-ui Specific to @mui/material
Projects
None yet
Development

No branches or pull requests

6 participants