Skip to content
+

Badge

Badge generates a small badge to the top-right of its child(ren).

Usage guidelines

  • Use badges for supplemental status: Use badges for short counts or compact states that update an existing control or item, such as unread messages on an inbox button. If the status is important on its own, show it in the UI instead of relying only on the badge.
  • Label the element that owns the badge: A badge is a visual cue tied to another element, so its meaning should be part of that element's accessible name. For example, use aria-label="Inbox, 4 unread messages" instead of aria-label="Inbox" on the target element.
  • Use dot badges for simple states: A dot badge does not show text or a number, so use it only when the surrounding UI makes the state clear, such as Online or Unread.
Press Enter to start editing

This demo applies the same pattern to a ListItemButton with a Badge: the visible count is included in the item's accessible name so it's announced in the context of the surrounding UI.

Badge content

Use badgeContent to add a short count or label to the wrapped element.

Press Enter to start editing

Dot badge

Use variant="dot" for a compact status indicator without a count.

Press Enter to start editing

Visibility

Control badge visibility with the invisible prop.

The badge hides automatically when badgeContent is zero. Override this with the showZero prop when zero is meaningful to the interface.

Press Enter to start editing

Maximum value

Use the max prop to cap large numeric values.

Press Enter to start editing

Customization

Color

Use the color prop to apply theme palette colors to the badge.

Press Enter to start editing

Badge alignment

Use the anchorOrigin prop to move the badge to any corner of the wrapped element.

Vertical
Horizontal
<IconButton aria-label="show 12 unread messages">
  <Badge
    badgeContent={12}
    color="secondary"
    anchorOrigin={{
      vertical: 'top',
      horizontal: 'right',
    }}
  >
    <MailIcon />
  </Badge>
</IconButton>

Badge overlap

Use the overlap prop when the wrapped element is circular.

Press Enter to start editing

Custom styles

Use theme style overrides, the sx prop, or styled() to customize the badge. Learn more in the customization guide.

API

See the documentation below for a complete reference to all of the props and classes available to the components mentioned here.