Allow Variant to be Specified for Navbar Item Badge #1690
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.
The scenario
When using the Navbar component and you want to add a Badge to a Navbar Item, you currently can't specify the variant of the badge you want to use, whilst you can change the colour, there's no variant option.
The problem
The normal Badge component allows you to specify
variant="solid"
, which renders a bold, high contrast badge. Thenavlist/badge.blade.php
doesn't have this option though, so you're left with a faded version.The solution
I've taken inspiration from how the normal Badge component handles the solid variant and made it possible, much like
badge-color
, to pass inbadge-variant
. Within the blade file, I've just copied the existing code frombadge.blade.php
as that works fine.Screenshots
Before
After