Skip to content

Style the sidebar badge like the console's soft badge - #680

Merged
AbhishekDoshi26 merged 5 commits into
mainfrom
mc/console-style-sidebar-badge
Sep 19, 2026
Merged

AbhishekDoshi26 merged 5 commits into
mainfrom
mc/console-style-sidebar-badge

Conversation

@easymac

@easymac easymac commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

The CI group's "deprecated" badge rendered as Starlight's default: a square mono-font chip flush against the label and hanging below its baseline, so the padding read as space inside the badge.

This ports the console's soft badge recipe from packages/ui/src/badge.tsx: one source color drives the text, a 35% border, and a 12% background, using the console's warning token values via light-dark(). The badge is now a pill in the sans font at 11px, with a gap after the label, and the group label is flex-centered so the badge lines up with the text and caret. The label is capitalized to match console badge casing.

Verified in both themes on the dev server.

cc @AbhishekDoshi26

Starlight's sidebar badge is a square mono-font chip that sits flush against
the group label and hangs below its baseline. Port the console's soft badge
recipe (one source color driving text, border, and background) with its
warning token, and flex-center the group label so the badge lines up with
the text and caret.

@AbhishekDoshi26 AbhishekDoshi26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup. The pill reads much better than the square chip, the label, badge and caret now share a center line (measured to within 0.01px), and I checked that light-dark() follows the site's theme toggle, which sets color-scheme along with data-theme. The port is faithful to softSurfaceClasses and the console's --warning-500 values.

One blocker: the light-mode badge text fails contrast. --warning-500 (#e69a6b) on its own 12% tint over the white sidebar is 2.08:1. WCAG AA needs 4.5:1 for 11px text, and production is currently at 6.36:1, so this is a regression. Dark mode is fine at 8.61:1. All three numbers were measured with computed styles in the browser.

The console's tokens already include the fix: --on-warning (oklch(0.5264 0.1135 48.92)) is its text-safe warning color for light surfaces. Using it for the text in light mode only gives 5.11:1, while the border and fill keep the soft recipe and dark mode stays unchanged. I tested the suggestion inline below in both themes. (The console's own "Needs attention" soft badge in plan-card.tsx has the same 2:1 problem, which may be worth passing along.)

Non-blocking: .sidebar-content .sl-badge applies the warning color to every sidebar badge. Only CI has one today, but scoping it to .sl-badge.caution would stop a future note or success badge from rendering orange.

CI is green.

Comment thread src/styles/custom.css Outdated
--warning-500 text on its own 12% tint over the white sidebar measured
2.08:1, below WCAG AA's 4.5:1 for 11px text (production was 6.36:1). The
console's --on-warning token brings light mode to 5.11:1. The border and
fill keep the soft recipe, and dark mode is unchanged at 8.61:1.
The soft badge shape (pill, sans font, spacing) still applies to every
sidebar badge, but only `caution` badges take the console's warning color,
so a future note or success badge keeps Starlight's variant colors instead
of rendering orange.
@AbhishekDoshi26
AbhishekDoshi26 merged commit ddfc7fe into main Sep 19, 2026
3 checks passed
@AbhishekDoshi26
AbhishekDoshi26 deleted the mc/console-style-sidebar-badge branch September 19, 2026 09:37
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

Successfully merging this pull request may close these issues.

2 participants