From: Mark Otto Date: Fri, 19 Dec 2025 06:36:41 +0000 (-0800) Subject: Update some badge stuff (#41955) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e0861bfb90b9f5165a13c9072c38d87112028d5;p=thirdparty%2Fbootstrap.git Update some badge stuff (#41955) --- diff --git a/scss/_badge.scss b/scss/_badge.scss index 67c96d3ee7..62dd972b3e 100644 --- a/scss/_badge.scss +++ b/scss/_badge.scss @@ -6,12 +6,12 @@ @use "mixins/gradients" as *; // scss-docs-start badge-variables -$badge-font-size: .75em !default; -$badge-font-weight: $font-weight-bold !default; +$badge-font-size: clamp(12px, .75em, .75em) !default; +$badge-font-weight: $font-weight-semibold !default; $badge-color: inherit !default; -$badge-padding-y: .35em !default; -$badge-padding-x: .5em !default; -$badge-border-radius: var(--border-radius) !default; +$badge-padding-y: .25em !default; +$badge-padding-x: .625em !default; +$badge-border-radius: var(--border-radius-lg) !default; // scss-docs-end badge-variables // scss-docs-start badge-variants @@ -43,7 +43,10 @@ $badge-variants: ( --badge-border-radius: #{$badge-border-radius}; // scss-docs-end badge-css-vars - display: inline-block; + display: inline-flex; + align-items: center; + justify-content: center; + min-height: 1.375rem; padding: var(--badge-padding-y) var(--badge-padding-x); font-size: var(--badge-font-size); font-weight: var(--badge-font-weight); diff --git a/site/src/content/docs/components/badge.mdx b/site/src/content/docs/components/badge.mdx index 9ab7b65426..3d1dab19ef 100644 --- a/site/src/content/docs/components/badge.mdx +++ b/site/src/content/docs/components/badge.mdx @@ -6,20 +6,18 @@ toc: true import { getData } from '@libs/data' -## Examples +## Example -Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units. As of v5, badges no longer have focus or hover styles for links. +Badges scale to match the size of the immediate parent element by using relative font sizing and `em` units. Badges come in three variants: solid (default), subtle, and outline. -### Base badge - -New`} /> - -New`} /> - -New`} /> +New + New + New`} /> ### Headings +Badges adapt to the `font-size` of the parent element. + Example heading New

Example heading New

Example heading New

@@ -45,7 +43,7 @@ Use utilities to modify a `.badge` and position it in the corner of a link or bu Inbox - + 99+ unread messages @@ -55,26 +53,21 @@ You can also replace the `.badge` class with a few more utilities without a coun Profile - + New alerts `} /> -## Background colors +## Variants -Set a `background-color` with contrasting foreground `color` with [our `.text-bg-{color}` helpers]([[docsref:helpers/color-background]]). Previously it was required to manually pair your choice of [`.text-{color}`]([[docsref:/utilities/colors]]) and [`.bg-{color}`]([[docsref:/utilities/background]]) utilities for styling, which you still may use if you prefer. +Use the contextual `.theme-{color}` classes to apply a semantic theme color to badges. `${themeColor.title}`)} /> `${themeColor.title}`)} /> + `${themeColor.title}`)} />
-## Pill badges - -Use the `.rounded-pill` utility class to make badges more rounded with a larger `border-radius`. - - `${themeColor.title}`)} /> - ## CSS ### Variables