ComponentStandalone

Badge

Small status indicator with color variants and optional pill shape. Reach for <wr-tag> (in the same entry) when you need a richer label — icons, loading state, outlined / transparent styles.

Installation

import { WrBadge, WrTag } from 'ngwr/badge';

@Component({ imports: [WrBadge, WrTag] })
export class MyComponent {}

Basic usage

New
<wr-badge>New</wr-badge>

Colors

primarysecondarysuccesswarningdangerinfolightmediumdark
<wr-badge color="primary">Primary</wr-badge>
<wr-badge color="success">Success</wr-badge>

Sizes

121212
<wr-badge size="sm">12</wr-badge>
<wr-badge size="md">12</wr-badge>
<wr-badge size="lg">12</wr-badge>

Shape

rounded (default) keeps the small form-radius, pill rounds the ends fully, and squircle takes the iOS-style smooth corner where corner-shape is supported.

primarysecondarysuccesswarningdangerinfolightmediumdark
<wr-badge color="primary" shape="pill">Beta</wr-badge>

Outlined

Transparent fill with a colored ring and text.

primarysecondarysuccesswarningdangerinfolightmediumdark
<wr-badge color="primary" outlined>Beta</wr-badge>

Tag — icons + loading

<wr-tag> is the richer sibling. Same entry (ngwr/badge), but supports icons, loading state, and outlined / transparent variants.

<wr-tag color="success" icon="checkmark">Done</wr-tag>
<wr-tag color="primary" outlined rounded>Beta</wr-tag>
<wr-tag color="warning" loading>Saving</wr-tag>
DoneBetaSaving

API

Inputs of <wr-badge>.

NameDescriptionTypeDefault
colorColor variant. Maps to --wr-color-* CSS variables from the theme.WrColor'primary'
sizeSize variant.WrBadgeSize'md'
shapeCorner treatment. Mirrors <wr-btn>rounded (default) uses the small form-radius; pill rounds the ends fully.WrBadgeShape'rounded'
outlinedOutlined style — transparent fill, colored border and text.booleanfalse

Tag API

Inputs of <wr-tag>, demoed above and shipped from the same entry point.

NameDescriptionTypeDefault
colorIntent colour.WrColor'primary'
iconIcon rendered beside the label.WrIconName | nullnull
iconPositionWhich side the icon sits on.'start' | 'end''start'
outlinedTransparent fill with a coloured ring.booleanfalse
transparentDrop the fill entirely.booleanfalse
roundedPill radius instead of the default.booleanfalse
hoverableAdd a hover affordance.booleanfalse
loadingSwap the icon for a spinner.booleanfalse

CSS variables

Custom properties ngwr/badge publishes. Each default below is declared on the component's own selector, so a :root override is shadowed by it — set them on that selector, on a wrapper you scope yourself, or inline on the element. Unlike the BEM class names, these are the supported way to restyle the component.

VariableDefaultDeclared on
--wr-badge-font-sizevar(--wr-text-xs).wr-badge +2 variant overrides
--wr-badge-font-weight600.wr-badge
--wr-badge-min-height1.5rem.wr-badge +2 variant overrides
--wr-badge-padding-x0.5rem.wr-badge +3 variant overrides
--wr-badge-padding-y0.25rem.wr-badge +2 variant overrides
--wr-badge-radiusvar(--wr-border-radius-sm).wr-badge +1 variant override
--wr-tag-bgvar(--wr-color-surface).wr-tag +3 variant overrides
--wr-tag-bordervar(--wr-color-outline).wr-tag +4 variant overrides
--wr-tag-colorvar(--wr-color-on-surface).wr-tag +3 variant overrides
--wr-tag-font-sizevar(--wr-text-xs).wr-tag
--wr-tag-font-weight500.wr-tag
--wr-tag-line-heightnormal.wr-tag
--wr-tag-min-height1.375rem.wr-tag
--wr-tag-padding-x0.5rem.wr-tag +1 variant override
--wr-tag-padding-y0.125rem.wr-tag
--wr-tag-radiusvar(--wr-border-radius-sm).wr-tag +1 variant override