Badges

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

Background colors

Use our background utility classes to quickly change the appearance of a badge. Please note that when using Bootstrap’s default .bg-light, you’ll likely need a text color utility like.text-dark for proper styling. This is because background utilities do not set anything butbackground-color.

PrimarySecondarySuccessDangerWarningInfoLightDark
<Badge bg="primary" as="span">
    Primary
</Badge>
<Badge bg="secondary" as="span">
    Secondary
</Badge>
<Badge bg="success" as="span">
    Success
</Badge>
<Badge bg="danger" as="span">
    Danger
</Badge>
<Badge bg="warning" text="dark" as="span">
    Warning
</Badge>
<Badge bg="info" text="dark" as="span">
    Info
</Badge>
<Badge bg="light" text="dark" as="span">
    Light
</Badge>
<Badge bg="dark" as="span">
    Dark
</Badge>

Soft badges

PrimarySecondarySuccessDangerWarningInfo
<Badge as="span" bg="light-primary" text="primary">
    Primary
</Badge>
<Badge as="span" bg="light-secondary">
    Secondary
</Badge>
<Badge as="span" bg="light-success" text="success">
    Success
</Badge>
<Badge as="span" bg="light-danger" text="danger">
    Danger
</Badge>
<Badge as="span" bg="light-warning" text="dark">
    Warning
</Badge>
<Badge as="span" bg="light-info" text="info">
    Info
</Badge>

Pill badges

Use the.rounded-pillutility class to make badges more rounded with a largerborder-radius.

PrimarySecondarySuccessDangerWarningInfoLightDark
<Badge bg="primary" pill={true}>
    Primary
</Badge>
<Badge bg="secondary" pill={true}>
    Secondary
</Badge>
<Badge bg="success" pill={true}>
    Success
</Badge>
<Badge bg="danger" pill={true}>
    Danger
</Badge>
<Badge bg="warning" pill={true} text="dark">
    Warning
</Badge>
<Badge bg="info" pill={true} text="dark">
    Info
</Badge>
<Badge bg="light" pill={true} text="dark">
    Light
</Badge>
<Badge bg="dark" pill={true}>
    Dark
</Badge>

Buttons

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

<Button variant="primary">
    Notifications
    <Badge bg="secondary">
        4
    </Badge>
</Button>

Positioned

Use utilities to modify a .badge and position it in the corner of a link or button.

<Button variant="primary" className="position-relative">
    Inbox
    <Badge bg="danger" pill className="position-absolute top-0 start-100 translate-middle">
        99+
    </Badge>
</Button>

You can also replace the .badge class with a few more utilities without a count for a more generic indicator.

<Button variant="primary" className="position-relative">
    Profile
    <Badge bg="danger" className="position-absolute top-0 start-100 translate-middle p-2 border border-light rounded-circle">
        
    </Badge>
</Button>

Simple Badge

Badges scale to match the size of the immediate parent element by using relative font sizing and em units.

Example heading New

Example heading New

Example heading New

Example heading New

Example heading New
Example heading New
<h1>
    Example heading
    <Badge bg="secondary">
        New
    </Badge>
</h1>
<h2>
    Example heading
    <Badge bg="secondary">
        New
    </Badge>
</h2>
<h3>
    Example heading
    <Badge bg="secondary">
        New
    </Badge>
</h3>
<h4>
    Example heading
    <Badge bg="secondary">
        New
    </Badge>
</h4>
<h5>
    Example heading
    <Badge bg="secondary">
        New
    </Badge>
</h5>
<h6>
    Example heading
    <Badge bg="secondary">
        New
    </Badge>
</h6>