Badge

Badges label status, category, or lightweight metadata without becoming primary actions.

Overview and decision boundary

Use Badge to label status, category, or lightweight metadata without creating another action.

Do not use badges as buttons or navigation targets.

Neutral24FeaturedPublishedReview neededSharedPublishingDeployment blocked
import { Check, CircleAlert, Info } from "@nerio-ui/adapters/icons";import { Badge } from "@nerio-ui/ui";<Badge>Neutral</Badge><Badge size="sm" tone="info">24</Badge><Badge size="lg" tone="success">Featured</Badge><Badge tone="success" leadingIcon={Check}>Published</Badge><Badge tone="warning" leadingIcon={CircleAlert}>Review needed</Badge><Badge tone="info" leadingIcon={Info} trailingIcon={Check}>Shared</Badge><Badge tone="primary-soft" loading>Publishing</Badge><Badge tone="danger" emphasis="strong" leadingIcon={CircleAlert}>Deployment blocked</Badge>

Installation and imports

Install the editable registry source, or use the matching package entrypoint when the product keeps Nerio as a workspace dependency.

pnpm dlx nerio add badgeimport { Check, CircleAlert } from '@nerio-ui/adapters/icons';import { Badge } from '@nerio-ui/ui';

Usage

PublishedSharedDeployment ready
import { Check, CircleAlert } from '@nerio-ui/adapters/icons';import { Badge } from '@nerio-ui/ui';<Badge tone="success" leadingIcon={Check}>Published</Badge><Badge tone="warning" trailingIcon={CircleAlert}>Review needed</Badge>

Variants

PublishedReviewBlockedAction neededDeployment blocked
ToneSoft (default)Strong
neutralRoutine metadata.Rarely needed; reserve for elevated neutral status.
primary-soft / accentSelected or brand-associated metadata.A compact brand moment that must stand out.
infoInformational context.Information that needs immediate scanning.
successA confirmed or completed state.A completion state that is especially important.
warningA state that needs review.A time-sensitive warning that needs attention.
dangerA blocked or failed state.A high-salience failure or risk that needs action.
242424
SizeUse
mdDefault size for standalone status and metadata labels.
smCompact size with reduced typography for an embedded Badge inside Button or another compact control.
lgLarger size for elevated standalone metadata that needs more visual presence.

Anatomy

Badge
┌───────────────────────────────────────────────┐
│ leadingIcon │            label │ trailingIcon │
└───────────────────────────────────────────────┘
SlotPurpose
rootInline status container with tone and tokenized density.
leading-iconOptional decorative icon before the visible label.
labelShort text that supplies the status or metadata meaning.
trailing-iconOptional decorative icon after the visible label.

States

PublishedNeeds reviewBlockedPublishing
StateBehavior
DefaultBadge is static metadata, not an interactive control.
LoadingSpinner replaces the leading icon and exposes aria-busy.
SoftDefault low-emphasis treatment for every tone.
StrongHigh-salience treatment for urgent warnings, blocking failures, or critical risk.
Sizemd is the default standalone size; sm is for compact embedded metadata and lg adds emphasis.
Comfortable / compactDensity tokens adjust height and padding without changing the API.

Motion

  • State changes should use shared motion tokens and preserve reduced-motion behavior.

Accessibility

  • Use concise text that does not rely on color alone.
  • Avoid using Badge as a button or link.
  • Use tone for semantic color; variant remains a deprecated compatibility alias.
  • Optional icons are decorative, so text must carry the status meaning.
  • Use leadingIcon or trailingIcon for visual context; the label remains the accessible status name.
  • Use sm when the Badge is embedded inside a compact control such as Button.
  • Use strong emphasis only when a warning, danger, or other status needs elevated attention.

API

SharedReview needed24
PropValuesPurpose
toneneutral | primary-soft | accent | info | success | warning | dangerSets semantic color treatment.
emphasissoft | strongSoft is default; strong increases visual urgency.
sizesm | md | lgmd is default; use sm inside compact controls and lg for elevated standalone metadata.
leadingIconIconComponentPlaces a decorative icon before the label.
trailingIconIconComponentPlaces a decorative icon after the label.
loadingbooleanShows a Spinner before the label and sets aria-busy.
variantneutral | info | success | dangerDeprecated compatibility alias for tone.
iconIconComponentDeprecated compatibility alias for leadingIcon.

Implementation contract

ContractValue
Registry itembadge installs 6 source files into the configured components directory.
Base UINo interactive primitive required.
Registry dependenciesNone.
Package dependenciesclsx, react

Styling contract

ContractValue
AuthoringComplete, statically detectable Tailwind CSS v4 recipes own component visuals.
ValuesSemantic and component --n-* variables remain the canonical customization layer.
OverridesCustomizable slots merge consumer className values with tailwindCn so conflicting utilities resolve deterministically.
Residual CSSOnly shared keyframes and scoped no-Preflight compatibility rules remain; there is no parallel visual selector layer.

Design notes

  • Use Badge to label status, category, or lightweight metadata without creating another action.

Do / do not

Do

Use concise, stable labels such as Draft, Published, Shared, or Blocked.

Do not

Use Badge as a button, link, or the only way to convey an important state.

Tokens

GroupTokensControls
Sizing--n-badge-height / --n-badge-height-sm / --n-badge-height-lg / --n-badge-font-size-sm / --n-badge-padding-inline-sm / --n-badge-padding-inline-lg / --n-badge-gap-sm / --n-badge-gap-lgControls default, compact, and elevated Badge dimensions.
Shape--n-badge-radiusControls the semantic pill radius.
Surface--n-badge-background / --n-badge-foregroundDefault Badge treatment.
Primary soft--n-badge-background-primary-soft / --n-badge-foreground-primary-softSoft brand treatment.
Accent--n-badge-background-accent / --n-badge-foreground-accentSoft accent treatment.
Soft statuses--n-badge-background-info / --n-badge-foreground-info / --n-badge-background-success / --n-badge-foreground-success / --n-badge-background-warning / --n-badge-foreground-warning / --n-badge-background-danger / --n-badge-foreground-dangerSoft semantic status treatments.
Strong neutral--n-badge-background-strong / --n-badge-foreground-strongHigh-salience neutral treatment.
Strong tones--n-badge-background-strong-primary / --n-badge-background-strong-info / --n-badge-background-strong-success / --n-badge-background-strong-warning / --n-badge-background-strong-dangerHigh-salience semantic status treatments.
Details--n-badge-icon-size / --n-spinner-size-smIcon and loading indicator sizing.