Skip to the page content

Badges

Small labels for counts, statuses and tags.

13 badge types

Solid badge

Bootstrap's .text-bg-* badges, filled with the palette. The fills are deepened just enough for the text to stay readable in every palette, light and dark.

Bootstrap
Primary Secondary In stock Sold out Low stock Pre-order Sample Archived
Show code
<span class="badge text-bg-primary">Primary</span>
<span class="badge text-bg-success">In stock</span>
<span class="badge text-bg-danger">Sold out</span>
<span class="badge text-bg-warning">Low stock</span>
<span class="badge text-bg-info">Pre-order</span>

Subtle badge

Bootstrap 5.3's soft style: a tinted fill, a matching border and the -emphasis text color. Calm enough for a status column in a long table.

Bootstrap
Sales-led Draft Paid Refunded Awaiting stock Annual plan
Show code
<span class="badge bg-success-subtle text-success-emphasis border border-success-subtle">
  Paid
</span>
<span class="badge bg-warning-subtle text-warning-emphasis border border-warning-subtle">
  Awaiting stock
</span>

Pill badge

Add .rounded-pill for fully rounded ends. Works with the solid and subtle styles alike, and suits counts and short tags.

Bootstrap
24 new orders New Hot 9 drafts Silk Bundle Limited
Show code
<span class="badge rounded-pill text-bg-primary">24<span class="visually-hidden"> new orders</span></span>
<span class="badge rounded-pill bg-success-subtle text-success-emphasis">Bundle</span>

Heading badge

Placed inside a heading, a badge scales with it, so the same markup fits a page title or a card title.

Bootstrap

Travel Planner New

Visit templates 32

Housekeeping checklists Updated

Customer portal Beta

Show code
<h3>Travel Planner <span class="badge text-bg-primary">New</span></h3>
<h4>Visit templates <span class="badge bg-secondary-subtle text-secondary-emphasis">32</span></h4>

Button badge

A badge inside a button, for a count that belongs to the action. Pick a badge that contrasts with the button's own fill.

Bootstrap
Show code
<button type="button" class="btn btn-primary">
  Orders to pack <span class="badge text-bg-light">4</span>
</button>
<button type="button" class="btn btn-outline-secondary">
  Drafts <span class="badge text-bg-secondary">2</span>
</button>

Positioned badge

Bootstrap's position utilities pin a badge to the corner of a button. Keep a visually hidden word inside so the number means something when read aloud.

Bootstrap
Show code
<button type="button" class="btn btn-outline-secondary position-relative">
  Inquiries
  <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-danger">
    7 <span class="visually-hidden">unread inquiries</span>
  </span>
</button>

<!-- A dot with no number: the words go in the button -->
<button type="button" class="btn btn-outline-secondary position-relative">
  Reviews<span class="visually-hidden">, new reviews waiting</span>
  <span class="position-absolute top-0 start-100 translate-middle p-1 bg-danger rounded-circle"
        aria-hidden="true"></span>
</button>

Status pill

Where a record stands, in words: a soft pill with an icon or a dot, colored by meaning. The live dot pulses for things happening now and stays still when reduced motion is on.

Status

With an icon

Paid Part paid Overdue Sent Void

With a dot

Waiting on you With the team Answered Live Draft
Show code
<span class="basalt-status basalt-status-success">
  <i class="bi bi-check-circle-fill" aria-hidden="true"></i>Paid
</span>
<span class="basalt-status basalt-status-dot basalt-status-warning">Waiting on you</span>
<span class="basalt-status basalt-status-dot basalt-status-live basalt-status-primary">Live</span>
<!-- Tones: --info --success --warning --danger --primary, or none for neutral -->

Dot badge

A quiet outlined label led by a colored dot, for categories where the color is only a hint. The eight tones follow the palette's chart colors, and the text stays at full strength.

Label

Industry

Home care Pet care Photography Cleaning

Region

Northeast Midwest West South

Larger

Self-serve Sales-led
Show code
<!-- --tone-1 to --tone-8 follow the chart colors -->
<span class="badge basalt-badge-as-dot basalt-badge-tone-1">Home care</span>
<span class="badge basalt-badge-as-dot basalt-badge-tone-2">Pet care</span>
<span class="badge basalt-badge-as-dot basalt-badge-lg basalt-badge-tone-3">Sales-led</span>

Trend badge

The change since the last period, beside a figure. The arrow shows the direction and the color shows whether that is good news, so churn going up turns red.

Label
MRR
$880kUp 2.4%
Trial starts
1,276Down 1.6%
Accounts churned
34Up 3
MRR per account
$411No change,0.0%
Show code
<span class="basalt-trend basalt-trend-up">
  <i class="bi bi-arrow-up-right" aria-hidden="true"></i>
  <span class="visually-hidden">Up </span>2.4%
</span>

<!-- Lower is better: add --invert so going up reads as bad news -->
<span class="basalt-trend basalt-trend-up basalt-trend-invert">…</span>
<span class="basalt-trend basalt-trend-flat">…</span>

Counter badge

A count pinned to the corner of an icon button. It bumps when the number changes, shows 99+ past ninety-nine, hides at zero, and keeps the button's label in step for screen readers. The cart uses the dot version.

Count
Show code
<span class="basalt-count-host">
  <button type="button" class="btn btn-outline-secondary" aria-label="Notifications, 3 unread">
    <i class="bi bi-bell" aria-hidden="true"></i>
  </button>
  <span class="basalt-count" aria-hidden="true">3</span>
</span>

<!-- --primary for a calmer tone, --dot for "something new" -->
<span class="basalt-count basalt-count-dot" aria-hidden="true"></span>

<script>
  // Sets the number, caps it at 99+, hides it at 0 and plays the bump.
  basaltCount(document.querySelector('.basalt-count'), 4);
</script>

Toggle badge

Pressable badges with a count, for the filter row above a list. Several can be on at once; with none on, everything shows.

Interactive

9 products

  • Sculpted Shoulder Blazer Clothing
  • Two-Tone Oxfords Accessories
  • Draped Column Gown Clothing
  • Aftercare Plan, monthly Extras
  • Cat-Eye Sunglasses Accessories
  • Leather Trench Coat Clothing
  • Express Delivery Pass Extras
  • Shield Sunglasses Accessories
  • Chalk-Stripe Suit Clothing
Show code
<div role="group" aria-label="Filter products by type">
  <button type="button" class="basalt-badge-toggle" aria-pressed="true">
    <i class="bi bi-check2 basalt-badge-toggle-check" aria-hidden="true"></i>
    Clothing
    <span class="basalt-badge-toggle-count">4</span>
  </button>
  <button type="button" class="basalt-badge-toggle" aria-pressed="false">
    Accessories <span class="basalt-badge-toggle-count">3</span>
  </button>
</div>

Status menu

A status pill that is also the control. Click it, or press Enter on it, to pick a new status from a dropdown; the pill takes the new color and a screen reader hears the change.

Interactive
Recent orders
Order Customer Status
#1042Sculpted Shoulder Blazer × 2 Sandra Franklin
#1041Bar Loafers × 2 Sabrina Kavanagh
#1039Made-to-Measure Tailoring Patricia Pemberton

Show code
<div class="dropdown basalt-status-menu" data-basalt-status-menu>
  <button type="button" class="basalt-status basalt-status-dot basalt-status-warning"
          data-bs-toggle="dropdown" aria-expanded="false"
          aria-label="Order #1042 status: Packing. Change status">
    <span data-basalt-status-label>Packing</span>
    <i class="bi bi-chevron-down basalt-status-menu-caret" aria-hidden="true"></i>
  </button>
  <ul class="dropdown-menu dropdown-menu-end">
    <li><button type="button" class="dropdown-item" data-status="info">
      <span class="basalt-status-menu-dot basalt-status-info"></span>New
      <i class="bi bi-check2 basalt-status-menu-check" aria-hidden="true"></i>
    </button></li>
    <!-- one item per status; the current one has .active -->
  </ul>
</div>

Removable badge

Badges with their own close button, for the filters applied to a list. Removing one moves focus to its neighbor, Undo brings it back in the same place, and Clear all empties the row. The arrow keys move between badges and Delete removes the focused one.

Interactive
Filters
  • IndustryHome care
  • TypeMaintenance
  • TerritoryNorth
  • StatusScheduled
  • ValueUnder $500

Showing 4 of 48 visits

  • ← → move between badges
  • Backspace removes the focused badge
Show code
<div data-basalt-removables>
  <ul class="basalt-removables" aria-label="Filters">
    <li>
      <span class="basalt-removable basalt-tone-primary">
        <span class="basalt-removable-key">Industry</span>Home care
        <button type="button" class="basalt-removable-remove"
                aria-label="Remove filter Industry: Home care">
          <i class="bi bi-x" aria-hidden="true"></i>
        </button>
      </span>
    </li>
  </ul>
  <p class="basalt-removables-empty" data-basalt-removables-empty hidden>No filters.</p>
  <button type="button" class="btn btn-sm btn-outline-secondary" data-basalt-removables-undo hidden>Undo</button>
  <button type="button" class="btn btn-sm btn-outline-secondary" data-basalt-removables-clear>Clear all</button>
  <p class="visually-hidden" aria-live="polite" data-basalt-removables-live></p>
</div>

<script>
  // Fires after every change, with the badges that are left.
  root.addEventListener('basalt:removableschange', (e) => saveTags(e.detail.items));
</script>