Skip to main content

Badge

Show a notification count or status dot beside an Avatar, Button, or other element. Unlike Tag, Badge decorates another element rather than labeling content.

import { Avatar, Badge } from '@jbpark/ui-kit';

<Badge dot color="success" indicatorLabel="Online">
<Avatar alt="Ada Lovelace" fallback="AL" />
</Badge>;
5ALGH99+

Props​

PropTypeDefaultDescription
countnumber-Count shown in the indicator.
dotbooleanfalseShow a dot instead of the count.
maxCountnumber99Show maxCount+ above this value.
showZerobooleanfalseShow a count of zero.
color'primary' | 'success' | 'warning' | 'danger''danger'Indicator color.
offsetreadonly [number, number][0, 0]Pixel inset from the wrapped element's top and inline end edges.
indicatorLabelstring-Accessible name for the count or dot.
childrenReactNode-Element decorated by the indicator. Omit for a standalone Badge.
classNamestring-Root class.
classNames{ indicator?: string }-Indicator class.

A count of zero is hidden unless showZero is set. dot takes precedence over count; a dot displays whenever dot is true. If neither is visible and there are no children, Badge renders nothing.

Give a meaningful indicatorLabel to a status dot, such as "Online". Without it, the dot is decorative and hidden from assistive technology. A count is readable by default; add indicatorLabel when its context is unclear or when you want an exact accessible count despite maxCount+ visual truncation.

Badge also accepts standard <span> props such as title, style, aria-*, and data-*.