Default badges
Badge component allows you to easily highlight new or unread items, label and categorize using keywords that describe them, notify users about some useful information and mark items depending on the priority. Badges don't have background color by default and require
.bg-*
color utility classes, some of them also require .text-*
classes to match color contrast ratio.
Basic examples | ||
---|---|---|
Primary badge | Primary | Primary color. To use, add .bg-primary class to the base .badge container |
Secondary badge | Secondary | Secondary color. To use, add .bg-secondary class to the base .badge container |
Danger badge | Danger | Red badge in danger context. To use, add .bg-danger class to the base .badge container |
Success badge | Success | Green badge in success context. To use, add .bg-success class to the base .badge container |
Warning badge | Warning | Orange badge in warning context. To use, add .bg-warning class to the base .badge container |
Info badge | Info | Cyan badge in info context. To use, add .bg-info class to the base .badge container |
Light badge | Light | Light color. To use, add .bg-light and .text-body classes to the base .badge container |
Dark badge | Dark | Dark color. To use, add .bg-dark class to the base .badge container |
Transparent badge | Transparent | Badge with transparent background. To use, add .text-body class to the base .badge container |
Additional colors | ||
Pink badge color | Pink | Pink color. To use, add .bg-pink class to the base .badge container |
Purple badge color | Purple | Purple color. To use, add .bg-purple class to the base .badge container |
Indigo badge color | Indigo | Indigo color. To use, add .bg-indigo class to the base .badge container |
Teal badge color | Teal | Teal color. To use, add .bg-teal class to the base .badge container |
Yellow badge color | Yellow | Yellow color. To use, add .bg-yellow and .text-black classes to the base .badge container |
Optional styles | ||
Roundless badge | Roundless badge | This badge doesn't have rounded borders. To use, add .rounded-0 class to the .badge element |
Block badge | Block badge | This badge fills 100% width of a parent element. To use, add .d-block or .w-100 class to the .badge element |
Linked badge | Linked badge | You can also use badges as a link in an <a> element |
Label with dropdown | Dropdown menu attached to the badge | |
Icon in badge | Badge with icon. To use, add .p-1 and color classes to .badge element |
|
Icon in linked badge | Linked badge with icon. To use, add .p-1 and color classes to .badge link element |
|
Icon in rounded badge | Rounded linked icon. Usage is the same, but with additional .rounded-pill class |
|
Icon in linked rounded badge | The same as above, but inside link element |
Striped badges
Striped badge simulates a classic styling of tags from the old days. All color versions have consistent background color that is set with
.bg-light
color utility class, and since the default styling of badge element is very limited, the use of other utilities is required. You can control the width of left/right border and its color, as well as background and text colors. All is configurable.
Basic examples | ||
---|---|---|
Primary badge | Primary | Primary border color. Requires a combination of various utility classes along with .border-primary class |
Secondary badge | Secondary | Secondary border color. Requires a combination of various utility classes along with .border-secondary class |
Danger badge | Danger | Red border color in danger context. Requires a combination of various utility classes along with .border-danger class |
Success badge | Success | Green border color in success context. Requires a combination of various utility classes along with .border-success class |
Warning badge | Warning | Orange border color in warning context. Requires a combination of various utility classes along with .border-warning class |
Info badge | Info | Cyan border color in info context. Requires a combination of various utility classes along with .border-info class |
Dark badge | Default | Dark border color. Requires a combination of various utility classes along with .border-dark class |
Additional colors | ||
Pink badge | Pink | Pink border color. Requires a combination of various utility classes along with .border-pink class |
Purple badge | Purple | Purple border color. Requires a combination of various utility classes along with .border-purple class |
Indigo badge | Indigo | Indigo border color. Requires a combination of various utility classes along with .border-indigo class |
Teal badge | Teal | Teal border color. Requires a combination of various utility classes along with .border-teal class |
Yellow badge | Yellow | Yellow border color. Requires a combination of various utility classes along with .border-yellow class |
Optional styles | ||
Right border | Right border | To highlight right border instead of left, add .border-end.rounded-end-0 classes in .badge element |
Linked badge | Linked badge | Linked striped badge. Use .border-* color class and other utility classes in <a> element |
Label with dropdown | Dropdown menu attached to the striped badge with optional caret | |
Icon in striped badge | Badge with icon. To use, add .p-1 and color classes to .badge element |
|
Icon in linked striped badge | Linked badge with icon. To use, add .p-1 and color classes to .badge link element |
Flat badges
Flat badges use background color with 20% opacity and corresponding text color. They don't require any custom class names as all styling is done via
.bg-opacity-25
background opacity class, which also works well in dark theme. Depending on design choice, you can change opacity level from 20% to 10|25|50|75|100 by using utility classes.
Basic examples | ||
---|---|---|
Primary badge | Primary | Light primary color. Use .bg-primary.text-primary classes in combination with .bg-opacity-20 to make primary background semi-transparent |
Secondary badge | Secondary | Light secondary color. Use .bg-secondary.text-secondary classes in combination with .bg-opacity-20 to make secondary background semi-transparent |
Danger badge | Danger | Light red color in danger context. Use .bg-danger.text-danger classes in combination with .bg-opacity-20 to make danger background semi-transparent |
Success badge | Success | Light green color in success context. Use .bg-success.text-success classes in combination with .bg-opacity-20 to make success background semi-transparent |
Warning badge | Warning | Light orange color in warning context. Use .bg-warning.text-warning classes in combination with .bg-opacity-20 to make warning background semi-transparent |
Info badge | Info | Light cyan color in info context. Use .bg-info.text-info classes in combination with .bg-opacity-20 to make info background semi-transparent |
Dark badge | Dark | Light black color. Use .bg-dark.text-reset classes in combination with .bg-opacity-20 to make dark background semi-transparent |
Additional colors | ||
Pink badge color | Pink | Light pink color. Use .bg-pink.text-pink classes in combination with .bg-opacity-20 to make pink background semi-transparent |
Purple badge color | Purple | Light purple color. Use .bg-purple.text-purple classes in combination with .bg-opacity-20 to make purple background semi-transparent |
Indigo badge color | Indigo | Light indigo color. Use .bg-indigo.text-indigo classes in combination with .bg-opacity-20 to make indigo background semi-transparent |
Teal badge color | Teal | Light teal color. Use .bg-teal.text-teal classes in combination with .bg-opacity-20 to make teal background semi-transparent |
Yellow badge color | Yellow | Light yellow color. Use .bg-yellow.text-yellow classes in combination with .bg-opacity-20 to make yellow background semi-transparent |
Flat badge options | ||
Roundless badge | Roundless badge | This badge doesn't have rounded borders. To use, add .rounded-0 class to the .badge element |
Linked flat badge | Linked badge | Use .badge and other utility classes in <a> element |
Block badge | Block badge | To make flat badge full width, use .d-block class. Works with linked badges as well |
Flat badge with dropdown | Dropdown menu attached to the flat badge with optional caret | |
Icon in flat badge | Icon inside flat badge. To use, add .p-1 in combination with color classes |
|
Icon in linked flat badge | Icon inside linked flat badge. To use, add .p-1 in combination with color classes |
|
Icon in flat rounded badge | Icon inside rounded flat badge. To use, add .p-1 in combination with color classes |
|
Icon in linked rounded badge | The same as above, but inside link element |
Pill badges
Rounded badges is a classic style of numeric values, mostly used as counters. All badges have minimum width that equals badge height, which means the badge is displayed as a perfect circle if the value consists of 1 digit and grows horizontally. No custom badge classes are required, just use global
.rounded-pill
utility class in .badge
element.
Basic examples | ||
---|---|---|
Primary pill badge | 32 | Primary color. Use .bg-primary and .rounded-pill classes |
Secondary pill badge | 78 | Secondary color. Use .bg-secondary and .rounded-pill classes |
Danger pill badge | 34 | Red color in danger context. Use .bg-danger and .rounded-pill classes |
Success pill badge | 65 | Green color in success context. Use .bg-success and .rounded-pill classes |
Warning pill badge | 76 | Orange color in warning context. Use .bg-warning and .rounded-pill classes |
Info pill badge | 98 | Cyan color in info context. Use .bg-info and .rounded-pill classes |
Light pill badge | 24 | Light color. Use .bg-light.text-body and .rounded-pill classes |
Dark pill badge | 72 | Dark color. Use .bg-dark and .rounded-pill classes |
Additional colors | ||
Pink badge color | 48 | Pink color. Use .bg-pink and .rounded-pill classes |
Purple badge color | 54 | Purple color. Use .bg-purple and .rounded-pill classes |
Indigo badge color | 20 | Indigo color. Use .bg-indigo and .rounded-pill classes |
Teal badge color | 86 | Teal color. Use .bg-teal and .rounded-pill classes |
Yellow badge color | 42 | Yellow color. To use, add .bg-yellow.text-dark and .rounded-pill classes |
Pill badge options | ||
Linked badge | 22 | Linked badge. Use .badge and other badge classes in <a> element |
Badge with dropdown | Dropdown menu attached to the badge element. |
|
Flat pill badges | ||
Primary badge | 59 | Light primary color. Use .bg-primary.text-primary.rounded-pill classes in combination with .bg-opacity-20 to make primary background semi-transparent |
Secondary badge | 64 | Light secondary color. Use .bg-secondary.text-secondary.rounded-pill classes in combination with .bg-opacity-20 to make secondary background semi-transparent |
Danger badge | 83 | Light red color in danger context. Use .bg-danger.text-danger.rounded-pill classes in combination with .bg-opacity-20 to make danger background semi-transparent |
Success badge | 93 | Light green color in success context. Use .bg-success.text-success.rounded-pill classes in combination with .bg-opacity-20 to make success background semi-transparent |
Warning badge | 38 | Light orange color in warning context. Use .bg-warning.text-warning.rounded-pill classes in combination with .bg-opacity-20 to make warning background semi-transparent |
Info badge | 67 | Light cyan color in info context. Use .bg-info.text-info.rounded-pill classes in combination with .bg-opacity-20 to make info background semi-transparent |
Dark badge | 82 | Light black color. Use .bg-dark.text-reset.rounded-pill classes in combination with .bg-opacity-20 to make dark background semi-transparent |
Additional colors | ||
Pink badge color | Pink | Light pink color. Use .bg-pink.text-pink classes in combination with .bg-opacity-20 to make pink background semi-transparent |
Purple badge color | Purple | Light purple color. Use .bg-purple.text-purple classes in combination with .bg-opacity-20 to make purple background semi-transparent |
Indigo badge color | Indigo | Light indigo color. Use .bg-indigo.text-indigo classes in combination with .bg-opacity-20 to make indigo background semi-transparent |
Teal badge color | Teal | Light teal color. Use .bg-teal.text-teal classes in combination with .bg-opacity-20 to make teal background semi-transparent |
Yellow badge color | Yellow | Light yellow color. Use .bg-yellow.text-yellow classes in combination with .bg-opacity-20 to make yellow background semi-transparent |
Flat pill badge options | ||
Linked pill badge | 49 | Linked pill flat badge. Use .badge and other border/text color classes in an <a> element |
Pill badge with dropdown | Dropdown menu attached to the badge with optional caret |