Fix sidebar badge outline style with Tailwind CSS #1765
Closed
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.
What kind of changes does this PR include?
Description
Outlined sidebar badges looks like this by default in Starlight:
When using Tailwind CSS, the outline style is thicker:
This is due to the variant (
outline
) being used as a CSS class name which collides with Tailwind CSSoutline
utility addingoutline-style: solid;
.This PR renames the class name to
sl-outline
to avoid the collision and get the following result matching the default Starlight style:Alternative approach
Edit: a potential alternative solution suggested by @martrapp could be to remove entirely the need of a CSS class for this and rely on a selector like
[aria-current='page'] :global(.sl-badge)
. This would mean not exposing theoutline
variant in #1530 (which is the current approach) but we would need to confirm that first.How to test
examples/tailwind/astro.config.mjs
to add a badge to the "Example Guide" sidebar link.pnpm dev
in theexamples/tailwind/
directory.http://localhost:4321/guides/example/