Badges help highlight important information, such as notifications or new and unread messages.

installyarn add @clayui/badge
versionNPM Version
useimport Badge from '@clayui/badge';
Badge Sizes have been removed. Use the clay-badge-size($map) mixinto create custom badge sizes for your app.

Variations

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

PrimarySecondarySuccessInfoWarningDangerLightDark

Snippet

Badge Sass API

The map $badge-palette allows generating any number of badge variants. If a key starts with ., #, or ’%’ Clay will output it as is, otherwise we will prepend .badge- to the key (e.g., .badge-primary). It will also generate a Sass placeholder prefixed by %badge- (e.g., %badge-primary).

Snippet

Outputs:

Snippet

Pill Badges

Use the .badge-pill modifier class to make badges more rounded.

PrimarySecondarySuccessInfoWarningDangerLightDark

Snippet

Anchor

Snippet

Snippet

Text Truncate

Wrap the text inside the .text-truncate-inline and .text-truncate modifier class.

ReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAreReallySuperInsanelyJustIncrediblyLongAndTotallyNotPossibleWordButWeAre

Snippet

Edit this page on GitHub

Contributors

Matuzalém Teles

Last edited May 12, 2025 at 7:56:02 PM