Data display

Badge

A compact label for a status, count or category.

Class nameTypeDescription
badgeplf:badgeComponentBadge; light grey on its own
badge-iconplf:badge-iconPartAn SVG icon in the badge; an icon class there doesn't need it
badge-labelplf:badge-labelPartThe text beside an icon
badge-softplf:badge-softStyleA light tint
badge-outlineplf:badge-outlineStyleA border without a fill
badge-neutralplf:badge-neutralColorNeutral (dark) color
badge-primaryplf:badge-primaryColorPrimary color
badge-successplf:badge-successColorSuccess color
badge-warningplf:badge-warningColorWarning color
badge-errorplf:badge-errorColorError color
badge-infoplf:badge-infoColorInfo color
Badge
Neutral Primary Success Warning Error Info

Write text that names the status, such as “3 unread messages”; color and icons only support it.

Draft Featured Published Needs review Failed Scheduled
Draft Featured Published Needs review Failed Scheduled
Changes saved Scheduled for tomorrow No icon

Use an <a href> for a badge that navigates; for a command, use a Button.

React

Badge from @pelatform/react renders this markup from its props, and badgeClass() gives a link or a router’s Link the same classes.

Prop Values Default
color neutral, primary, success, warning, error, info Light grey
variant soft, outline, in the badge’s color, or grey without one Filled

The part is BadgeLabel, and the other props are a span’s, className and ref included; badgeClass() takes color and variant.

CSS variables

Override on a root or on a single badge; they win over the modifiers. On a root, --plf-badge-bg and --plf-badge-color therefore reach every color and style: scope them to one, such as .badge-primary (.plf\:badge-primary with Prefixed CSS), or set the semantic color, such as --plf-color-primary, which every style of that color follows; the outline and soft text follow its text color, such as --plf-color-primary-text.

Variable Default
--plf-badge-bg, --plf-badge-color Set by the color and style; light grey without a color
--plf-badge-border Transparent; on outline, --plf-color-input for neutral or the color’s border
--plf-badge-radius Full radius (pill)
--plf-badge-height 1.375rem (22px) minimum; links are at least 24px
--plf-badge-font-size, --plf-badge-font-weight 12px, medium; independent of the body font size
--plf-badge-icon-size 1em

Built with Pelatform UIv0.1.0

Components

Getting started

Foundations

Components

Actions

Data display

Navigation

Feedback

Data input

Layout

Advanced

Integrations

Blocks

Application

Authentication

Icons