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 matBadge to be empty #15444

Closed
mackelito opened this issue Mar 12, 2019 · 13 comments
Closed

Allow matBadge to be empty #15444

mackelito opened this issue Mar 12, 2019 · 13 comments
Labels
area: material/badge needs: discussion Further discussion with the team is needed before proceeding P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@mackelito
Copy link

What is the expected behavior?

If matBadge is used but without a value it should still show but empty

What is the current behavior?

element is not rendered

What are the steps to reproduce?

https://stackblitz.com/edit/angular-5zk8sa?file=app/badge-overview-example.html

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

@crisbeto
Copy link
Member

What is a case where you'd want to show a blank badge?

@mackelito
Copy link
Author

When the number does not matter.. just to show it as a notification indicator.
It would broaden the use cases for the component as well :)

Kind of like the notice on the "Home" icon here:
notifications-linkedin-petra-fisher-trainer-consultant-expert-01

@crisbeto
Copy link
Member

The one on LinkedIn isn't blank either though, it has a dot in it.

@LoganDupont
Copy link

If you need an example just look at github notification icon
image

@jelbourn
Copy link
Member

@mackelito does it work if you just use a space?

@jelbourn jelbourn added discussion needs: clarification The issue does not contain enough information for the team to determine if it is a real bug P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels May 15, 2019
@mackelito
Copy link
Author

@mackelito does it work if you just use a space?

It did not work using space... but I have not tried it with the latest release..

@crisbeto
Copy link
Member

Maybe we should stop trimming the message if it's just whitespace?

@jelbourn jelbourn removed the needs: clarification The issue does not contain enough information for the team to determine if it is a real bug label May 18, 2019
@jelbourn
Copy link
Member

jelbourn commented May 18, 2019

@crisbeto ¯\(ツ)

I don't feel strongly either way

@mmalerba mmalerba added needs: discussion Further discussion with the team is needed before proceeding and removed discussion labels Mar 3, 2020
@wratho
Copy link

wratho commented Aug 24, 2020

any changes in this discussion. I would also like this to be an option. I'd be fine with an Input the the component to allow it so it is explicit and you don't have to guess at the developers intention.

@rafaelss95
Copy link
Contributor

Well, I needed this in a project that I'm working on and I'm currently using matBadge="&# 8288;" (space added after hash to not reference an issue) and it seems to work until now.

@jelbourn
Copy link
Member

Is there a strong reason not to use use a CSS class with a ::before or ::after style to add a little indicator? Looking at this again, using matBadge seems like overkill.

@jelbourn
Copy link
Member

jelbourn commented Mar 9, 2021

Closing this since you can accomplish a notification dot with plain CSS without needing matBadge

@jelbourn jelbourn closed this as completed Mar 9, 2021
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/badge needs: discussion Further discussion with the team is needed before proceeding P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
8 participants