Skip to content

Badge

Displays a small notification count or status indicator on another element.

First release: 1.0.0 Latest update: July 1, 2025 Current version: 1.0.0

React Angular Vue Svelte HTML

Import

import { PlusBadge } from '@plusui/react';
import { PlusBadgeComponent } from '@plusui/angular';
import { PlusBadge } from '@plusui/vue';
import PlusBadge from '@plusui/svelte';
<script src="https://cdn.jsdelivr.net/npm/@plusui/core"></script>

Package

@plusui/react
@plusui/angular
@plusui/vue
@plusui/svelte
@plusui/core

Docs

Changelog

Badge Changelog

Recent changes and updates for the badge component

v1.0.0

June 20, 2025
Feat

Added Badge component for status indicators

  • Multiple status variants
  • Dot and count styles
  • Customizable content
  • Accessibility support

The Badge component is used to display small pieces of information, such as notification counts or status indicators, typically attached to another UI element.

Badge - anatomy

A basic badge can display content (like a number) attached to an element, or act as a simple status dot.

Show code

Use the status prop to change the color variant: default, primary, success, warning, danger, info.

Show code

Control the badge size with the size prop: sm, md (default), lg.

Show code

Use the orientation prop to place the badge at different corners (top-right (default), top-left, bottom-right, bottom-left) relative to the element in the default slot. Use the offset prop (format: “x,y”) to fine-tune the position.

Show code
Badge - layout spacing Badge - light & dark mode
  • Keyboard Behavior: Badges are typically non-interactive and do not receive focus.
  • Screen Reader:
    • The component uses role="status" and aria-live="polite" to ensure that badge content (especially counts or status changes) is announced by screen readers.
    • When a badge represents critical information (e.g., “Offline”), ensure the surrounding context or the element the badge is attached to provides sufficient information. For purely decorative badges or status dots where the meaning is clear from context (e.g., a green dot next to “Online”), explicit labeling might not be necessary, but consider if additional aria-label or aria-describedby on the associated element could improve clarity.
  • Required Developer Actions:
    • If the badge conveys important status information not otherwise available textually (e.g., a red dot indicating an error without accompanying text), provide an accessible label for the element the badge is associated with, or use visually hidden text within the host element to describe the badge’s meaning.
NameTypeDefaultDescriptionRequired
status`‘default''primary''success''warning'
size`‘sm''md''lg’`'md'
orientation`‘top-left''top-right''bottom-left''bottom-right'
offset[string, string] (parsed from “x,y”)undefinedFine-tune position with x,y offset (e.g., “5px,-2px”).No
contentstringundefinedText/number content for the badge (alternative to slot).No
NameDescription
(default)The element the badge is attached to (anchor element).
badge-contentThe content displayed inside the badge (overrides content prop).
PartDescription
badgeThe main badge container element.
NameDescription
--text-colorBadge text color.
--border-colorBadge border color.
--bg-defaultBadge background color.

Join the Community

Plus UI is built by the community. Join us on our platforms to contribute, get help, and stay up to date.