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

[BadgeUnstyled] Unstyled API shape discussion #31868

Closed
michaldudak opened this issue Mar 18, 2022 · 3 comments · Fixed by #31974
Closed

[BadgeUnstyled] Unstyled API shape discussion #31868

michaldudak opened this issue Mar 18, 2022 · 3 comments · Fixed by #31974
Labels
component: badge This is the name of the generic UI component, not the React module! new feature New feature or request package: base-ui Specific to @mui/base

Comments

@michaldudak
Copy link
Member

michaldudak commented Mar 18, 2022

When writing the docs for the unstyled badge, a few improvements to the API came to my mind:

  • classes prop can be removed to match other unstyled components
  • anchorOrigin doesn't do anything except set a class name. I propose to remove it and let developers implement positioning props of their choosing.
  • variant="dot" is not necessarily a dot - it must be styled by the developer. Setting badgeContent to an empty string and making the badge smaller would have the same effect. Therefore, variant could be removed from the unstyled component.
  • max and showZero make sense only when badgeContent is a number. We could have two overloads of the badge function - one that takes a { badgeContent: number, max?: number, showZero?: boolean } and the other one with { badgeContent?: ReactNode }
  • utility classes should have a MuiBadgeUnstyled- prefix

cc @hbjORbj, @mnajdova

@michaldudak michaldudak added new feature New feature or request component: badge This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Mar 18, 2022
@michaldudak michaldudak moved this to To do 📃 in Base UI Mar 18, 2022
@mnajdova
Copy link
Member

No objection from my side.

@hbjORbj
Copy link
Member

hbjORbj commented Mar 18, 2022

I agree with everything. If we remove variant='dot', we only have variant='standard' in unstyled Badge component. Do we need variant prop then?

@michaldudak
Copy link
Member Author

If we remove variant='dot', we only have variant='standard' in unstyled Badge component. Do we need variant prop then?

No, I think we can remove the variant altogether.

@michaldudak michaldudak self-assigned this Mar 18, 2022
@michaldudak michaldudak moved this from To do 📃 to In progress 🛠 in Base UI Mar 24, 2022
Repository owner moved this from In progress 🛠 to Done 🎉 in Base UI Mar 29, 2022
@michaldudak michaldudak removed their assignment May 23, 2022
@michaldudak michaldudak removed this from Base UI Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: badge This is the name of the generic UI component, not the React module! new feature New feature or request package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants