Components
Badge
Small count-and-label components with the bracket radius and the full eleven-color theme palette.
How it works
Badges are pure CSS in stock Bootstrap and they stay that way here. The only theme changes are the 2 px
bracket radius, a heavier weight (700) and three extra colours — gold, navy and
cream — exposed through the .text-bg-* helpers.
Examples
Badges scale to their parent with relative sizing (0.75em), so they fit any heading level.
Example heading New
Example heading New
Example heading New
Example heading New
Example heading New
Example heading New
HTML
<h1>Example heading <span class="badge text-bg-secondary">New</span></h1>
<h2>Example heading <span class="badge text-bg-secondary">New</span></h2>
<h3>Example heading <span class="badge text-bg-secondary">New</span></h3>
<h4>Example heading <span class="badge text-bg-secondary">New</span></h4>
<h5>Example heading <span class="badge text-bg-secondary">New</span></h5>
<h6>Example heading <span class="badge text-bg-secondary">New</span></h6>Buttons
Badges work as counters inside buttons.
HTML
<button type="button" class="btn btn-primary">
Notifications <span class="badge text-bg-navy">4</span>
</button>
A number alone is meaningless to a screen reader. Add context with a .visually-hidden span or
a label on the parent.
HTML
<button type="button" class="btn btn-navy">
Inbox <span class="badge text-bg-gold">9</span>
<span class="visually-hidden">unread messages</span>
</button>Positioned
Use position utilities to pin a badge to a corner of a button or link.
HTML
<button type="button" class="btn btn-primary position-relative">
Inbox
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-danger">
99+
<span class="visually-hidden">unread messages</span>
</span>
</button>
For a status dot with no count, replace the text with .p-2 and a border so it stands out from
the button.
HTML
<button type="button" class="btn btn-navy position-relative">
Profile
<span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle">
<span class="visually-hidden">New alerts</span>
</span>
</button>Background colors
Set the background and a contrasting text colour in one go with .text-bg-{color}. Gold, cream,
warning and primary get navy text; navy, dark, danger and the rest get light text. In dark mode
primary swaps to gold-500; the text colour is compiled, so check contrast if you
override the background.
HTML
<span class="badge text-bg-primary">Primary</span>
<span class="badge text-bg-secondary">Secondary</span>
<span class="badge text-bg-success">Success</span>
<span class="badge text-bg-danger">Danger</span>
<span class="badge text-bg-warning">Warning</span>
<span class="badge text-bg-info">Info</span>
<span class="badge text-bg-light">Light</span>
<span class="badge text-bg-dark">Dark</span>
<span class="badge text-bg-gold">Gold</span>
<span class="badge text-bg-navy">Navy</span>
<span class="badge text-bg-cream">Cream</span>.text-bg-gold for a champion, title holder or "new"; .text-bg-navy
for stats and seeds; .text-bg-cream for a quiet label on dark cards.Pill badges
Add .rounded-pill for fully rounded ends. This overrides the 2 px bracket radius.
HTML
<span class="badge rounded-pill text-bg-primary">Primary</span>
<span class="badge rounded-pill text-bg-secondary">Secondary</span>
<span class="badge rounded-pill text-bg-success">Success</span>
<span class="badge rounded-pill text-bg-danger">Danger</span>
<span class="badge rounded-pill text-bg-warning">Warning</span>
<span class="badge rounded-pill text-bg-info">Info</span>
<span class="badge rounded-pill text-bg-light">Light</span>
<span class="badge rounded-pill text-bg-dark">Dark</span>
<span class="badge rounded-pill text-bg-gold">Gold</span>
<span class="badge rounded-pill text-bg-navy">Navy</span>
<span class="badge rounded-pill text-bg-cream">Cream</span>Brand use
A tournament bracket seed or a title reign reads best with the .stat helper (mono, tabular
numerals) on the badge.
#1 #16 #128
Champion 1,281 days
HTML
<p class="mb-2">
<span class="badge text-bg-navy stat">#1</span>
<span class="badge text-bg-navy stat">#16</span>
<span class="badge text-bg-navy stat">#128</span>
</p>
<p class="mb-0">
<span class="badge text-bg-gold">Champion</span>
<span class="badge text-bg-gold stat">1,281 days</span>
</p>CSS
All of Bootstrap's --bs-badge-* variables apply.
.badge {
--bs-badge-padding-x: 0.65em;
--bs-badge-padding-y: 0.35em;
--bs-badge-font-size: 0.75em;
--bs-badge-font-weight: 700; // $badge-font-weight
--bs-badge-color: #fff;
--bs-badge-border-radius: 2px; // $badge-border-radius: $border-radius-sm
}
.badge itself has no background. Pair it with .text-bg-*, or with
.bg-* plus a .text-* utility of your choosing. See
Color & background.