Skip to main content
Neighborhood Design System v5.1.0

Badge

Ready

A small label for short status or highlight text, with optional prefix and suffix content.

Preview

Open in Storybook (opens in new tab)

Code

Install
npm install @fbin-web/neighborhood-core
Import
import { NbhdBadge } from '@fbin-web/neighborhood-core';
Usage
<nbhd-badge> New </nbhd-badge>

Properties

PropertyAttributeTypeDefaultDescription
cssClasscss-classstring—Additional CSS classes to apply to the badge.

Slots

NameDescription
(default)Badge content.
prefixContent rendered before the badge content.
suffixContent rendered after the badge content.

CSS Parts

NameDescription
baseThe root wrapper for the badge.
prefixThe slot container for the prefix content.
contentThe slot container for the default badge content.
suffixThe slot container for the suffix content.
nbhd-badge::part(base) {
  /* your styles */
}

CSS Properties

Set these on nbhd-badge or an ancestor to override the defaults. Token is the design token a default comes from and Value is what it resolves to in core Neighborhood; brands may override them. Properties that adapt to surface follow the light or inverse surface they sit on until you set them.

PropertyTokenValue Copy
--nbhd-badge-backgroundColor--nbhd-color-surface-highlight#e3f2fd
--nbhd-badge-borderColor—rgba(0, 0, 0, 0)
--nbhd-badge-borderRadius--nbhd-border-radius-none0
--nbhd-badge-borderStyle—solid
--nbhd-badge-borderWidth--nbhd-border-width-subtle1px
--nbhd-badge-color--nbhd-color-text-primary#1c1d1f
--nbhd-badge-display—inline-block
--nbhd-badge-fontFamily--nbhd-typography-badge-fontFamilysans-serif
--nbhd-badge-fontSize--nbhd-typography-badge-fontSize0.625rem
--nbhd-badge-fontStyle—inherit
--nbhd-badge-fontWeight--nbhd-typography-badge-fontWeight700
--nbhd-badge-host-display—inline-block
--nbhd-badge-insetBlockEnd—auto
--nbhd-badge-insetBlockStart—auto
--nbhd-badge-insetInlineEnd—auto
--nbhd-badge-insetInlineStart—auto
--nbhd-badge-letterSpacing—normal
--nbhd-badge-lineHeight--nbhd-typography-badge-lineHeight1
--nbhd-badge-maxInlineSize—100%
--nbhd-badge-overflow—hidden
--nbhd-badge-paddingBlock--nbhd-space-14px
--nbhd-badge-paddingInline--nbhd-space-14px
--nbhd-badge-position—static
--nbhd-badge-textAlign—center
--nbhd-badge-textOverflow—ellipsis
--nbhd-badge-textTransform—uppercase
--nbhd-badge-textWrap—nowrap

Dependencies

Used by

Esc
↑ ↓ to move↵ to open