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

Badge should have a color property #1033

Closed
rehandalal opened this issue May 6, 2020 · 6 comments
Closed

Badge should have a color property #1033

rehandalal opened this issue May 6, 2020 · 6 comments

Comments

@rehandalal
Copy link

rehandalal commented May 6, 2020

What problem does this feature solve?

Sometimes you want the Badge to be different colors. I tried following the example in the docs and when the Badge is not wrapped around an element setting the background color changes the color of the Badge:
image

When wrapped around a button however the background of the button changes to the expected color but not the Badge:
image

In this case I am using badge as status indicator --- green for good and red for bad.

What does the proposed API look like?

The proposed API would be similar to Tag or Button where you pass through a color property and that is used to set the color of the Badge.

Alternatively perhaps it should pass the className and style properties down to the .rs-badge-content element when the badge is wrapping an element.

@hiyangguo
Copy link
Member

@rehandalal You can change color by this way:

  1. Add a class to <Badge/>
<Badge className="green">
      <Button>New Message</Button>
    </Badge>
  1. Add some styles
.rs-badge.green .rs-badge-content{
  background: #008000;
}

And we will consider your advice.Thank you for you feedback.

@rehandalal
Copy link
Author

Thanks! This is what I am currently doing. But it would nice to have it just work out-the-box.

@hiyangguo
Copy link
Member

We will consider how to realization it better in the subsequent version.

@hiyangguo
Copy link
Member

@simonguo

@simonguo
Copy link
Member

It can be designed to be consistent with the button color, while supporting custom colors.

@simonguo
Copy link
Member

Supported in rsuite v5.

npm i rsuite@next

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants