Skip to content

style(badge): added a min-inline-size #4715

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/components/src/components/badge/badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
inline-size: fit-content;
font-weight: 700;

// I added a minimum inline size, especially for single-character content, to ensure that it won't be any narrower than a circle.
&:not(:empty) {
min-inline-size: calc(1.4em - 2 * #{variables.$db-spacing-fixed-2xs});
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

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

Changing box-sizing to content-box only for badges with min-inline-size could create inconsistent sizing behavior. Consider documenting why this change is necessary or ensuring it doesn't conflict with other badge styling.

Suggested change
min-inline-size: calc(1.4em - 2 * #{variables.$db-spacing-fixed-2xs});
min-inline-size: calc(1.4em - 2 * #{variables.$db-spacing-fixed-2xs});
// Set box-sizing to content-box so that min-inline-size applies only to the content,
// not including padding and border. This ensures that single-character badges remain
// circular and do not shrink below the intended size. Note: This differs from the
// default border-box used elsewhere, and may cause inconsistent sizing if not handled
// carefully. If you change badge padding or border, review this logic to avoid layout bugs.

Copilot uses AI. Check for mistakes.

box-sizing: content-box;
}

&:has(.db-icon) {
padding: variables.$db-spacing-fixed-3xs;
}
Expand Down
Loading