Badges

Documentation and examples for badges, our small count and labeling component.


Example

Badges can be used as part of links or buttons to provide a counter.

<button type="button" class="btn btn-primary">
  Notifications <span class="badge badge-default">4</span>
</button>

Contextual variations

Add any of the below mentioned modifier classes to change the appearance of a badge.

Primary Info Success Danger Warning Default Secondary
<span class="badge badge-primary">Primary</span>
<span class="badge badge-info">Info</span>
<span class="badge badge-success">Success</span>
<span class="badge badge-danger">Danger</span>
<span class="badge badge-warning">Warning</span>
<span class="badge badge-default">Default</span>
<span class="badge badge-secondary">Secondary</span>

Pill badges

Use the .badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding). Useful if you miss the badges from v3.

Primary Info Success Danger Warning Default Secondary
<span class="badge badge-pill badge-primary">Primary</span>
<span class="badge badge-pill badge-info">Info</span>
<span class="badge badge-pill badge-success">Success</span>
<span class="badge badge-pill badge-danger">Danger</span>
<span class="badge badge-pill badge-warning">Warning</span>
<span class="badge badge-pill badge-default">Default</span>
<span class="badge badge-pill badge-secondary">Secondary</span>

Using the contextual .badge-* classes on an <a> element quickly provide actionable badges with hover and focus states.

<a href="#" class="badge badge-primary">Primary</a>
<a href="#" class="badge badge-info">Info</a>
<a href="#" class="badge badge-success">Success</a>
<a href="#" class="badge badge-danger">Danger</a>
<a href="#" class="badge badge-warning">Warning</a>
<a href="#" class="badge badge-default">Default</a>
<a href="#" class="badge badge-secondary">Secondary</a>