fix(material-experimental/theming): implement M3 badge #28460
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Aligns the badge with the M3 spec. This required a few issues to be fixed:
width
andheight
. This is incorrect, because it prevents the badge from scaling with the text. I've resolved it while keeping the old behavior by introducing new tokens that targetmin-width
andmin-height
while the old ones still targetwidth
andheight
.top
,bottom
,left
andright
. This is problematic, because it anchors the badge to the specific point in the host, causing the content to grow inwards instead of outwards. I've fixed it by using the opposite dimensions to position the badge (e.g.bottom: 100%
instead oftop: -20px
) and then using a negative margin to offset the badge from there. This approach also has the advantage of producing less CSS.