Skip to content

Badge

Badges are small status indicators that highlight information or draw attention to specific elements.

Usage

Use badges to label, categorize, or indicate status. Common uses include notification counts, status labels, and category tags.

Variants

PrimarySecondarySuccessWarningErrorNeutral
html
<span class="df-badge df-badge--primary">Primary</span>
<span class="df-badge df-badge--secondary">Secondary</span>
<span class="df-badge df-badge--success">Success</span>
<span class="df-badge df-badge--warning">Warning</span>
<span class="df-badge df-badge--error">Error</span>
<span class="df-badge df-badge--neutral">Neutral</span>

Outline Variants

PrimarySecondarySuccessWarningError
html
<span class="df-badge df-badge--primary-outline">Primary</span>
<span class="df-badge df-badge--success-outline">Success</span>

Sizes

SmallMediumLarge
html
<span class="df-badge df-badge--primary df-badge--sm">Small</span>
<span class="df-badge df-badge--primary">Medium</span>
<span class="df-badge df-badge--primary df-badge--lg">Large</span>

With Icon

Verified Pending Failed
html
<span class="df-badge df-badge--success">
  <svg><!-- check icon --></svg>
  Verified
</span>

Dot Indicator

OnlineAwayOffline
html
<span class="df-badge df-badge--success df-badge--dot">Online</span>

Notification Badge

3
99+
html
<div class="notification-wrapper">
  <svg><!-- bell icon --></svg>
  <span class="df-badge df-badge--error df-badge--count">3</span>
</div>

Pill Badge

New FeatureBetaActive
html
<span class="df-badge df-badge--primary df-badge--pill">New Feature</span>

Removable Badge

JavaScript React
html
<span class="df-badge df-badge--neutral df-badge--removable">
  JavaScript
  <button class="df-badge__remove" aria-label="Remove">
    <svg><!-- close icon --></svg>
  </button>
</span>

Status Examples

ActiveJohn Doe - john@example.com
PendingJane Smith - jane@example.com
InactiveBob Wilson - bob@example.com

Accessibility

  • Use meaningful text that describes the status
  • For icon-only badges, include aria-label
  • Ensure sufficient color contrast
  • Don't rely on color alone to convey meaning

Best Practices

  • Keep badge text short (1-2 words)
  • Use consistent colors for the same status types
  • Position badges consistently throughout the UI
  • Consider using icons to reinforce meaning

API Reference

Classes

ClassDescription
df-badgeBase badge class
df-badge--primaryPrimary color
df-badge--secondarySecondary color
df-badge--successSuccess/green color
df-badge--warningWarning/yellow color
df-badge--errorError/red color
df-badge--neutralNeutral/gray color
df-badge--smSmall size
df-badge--lgLarge size
df-badge--pillPill shape (more rounded)
df-badge--dotWith dot indicator
df-badge--countNotification count style
df-badge--removableWith remove button

Built with care by Everforth