components

Tailwind CSS Badge

Badges serve to communicate the status of particular data to the user.

Class Name
Type
Description
badgeComponentBase class for the badge component.
badge-neutralModifierBadge with ’neutral’ color.
badge-primaryModifierBadge with ‘primary’ color.
badge-secondaryModifierBadge with ‘secondary’ color.
badge-accentModifierBadge with ‘accent’ color.
badge-infoModifierBadge with ‘info’ color.
badge-successModifierBadge with ‘success’ color.
badge-warningModifierBadge with ‘warning’ color.
badge-errorModifierBadge with ’error’ color.
badge-softModifierSoft colored badge.
badge-outlineModifierTransparent badge with colored border.
badge-xsResponsiveBadge with extra small size.
badge-smResponsiveBadge with small size.
badge-lgResponsiveBadge with large size.
badge-xlResponsiveBadge with extra-large size.
rounded-fullUtilityUtility class for rounded badges.

The standard format for badge is component class badge, accompanied by modifier class badge-{semantic-color}.

Add modifier class badge-soft for soft colored badges.

Add modifier class badge-outline for outline badges.

Use the rounded-full utility class to make badges pilled. The default shape of the badges but can be altered by using TailwindCSS Border Radius utility classes.

This is the Default shape of the badge.

Add responsive class badge-{size} where {size} = xs|sm|default|lg|xl for badges of different sizes.

Use badges in anchor tags for clickable badge links.

Use badge with utility classes height(h), width(w) or size & p-0 for dot style badges.

Use svg or icons inside badges for icon badges.

Add utility classes size & p-0 for square icon badges.

Add utility classes rounded-full, size & p-0 for circular Icon badges.

Badges used in text inherit the font size of the immediate parent element.

Add badges to buttons to display additional information in buttons.

Use the img tag to display avatar badges with an image.

Required FlyonUI JS

Dismissible badges are also referred as chips.

Include the data-remove-element attribute in the close button element and set its value to #id to specify the element to be removed. Customize the removal animation by incorporating the removing: modifier, as illustrated below.

A simple example of dismissible avatar badges.