MDK Logo
UI Kitreact-devkitComponentsCoreDisplay

Badge

Badge component - Display badge with number or dot

Badge component - Display badge with number or dot

import { Badge } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
childrenOptionalReact.ReactNodeBadge content (wraps children with badge)
countOptionalnumber | undefinedNumber to display in badge If > overflowCount, will show "overflowCount+"
overflowCountOptionalnumber | undefined99Maximum count to display
showZeroOptionalboolean | undefinedfalseWhether to show badge when count is 0
dotOptionalboolean | undefinedfalseShow badge as a dot
textOptionalstring | undefinedCustom badge content (overrides count)
colorOptionalColorVariant | undefined'primary'Color variant
sizeOptionalComponentSize | undefined'md'Badge size
offsetOptional[number, number] | undefined[0, 0]Offset position [x, y] in pixels
squareOptionalboolean | undefinedfalseSquare badge (no border-radius)
classNameOptionalstring | undefinedCustom className for badge
wrapperClassNameOptionalstring | undefinedCustom className for wrapper
titleOptionalstring | undefinedBadge title for accessibility
statusOptional"success" | "warning" | "error" | "default" | "processing" | undefinedStatus badge (small dot badge with text)

Usage

Small status indicator displayed standalone or overlaid on another element. Renders as a number, dot, custom text, or status pill.

Notes

  • When used without children, renders standalone.
  • dot and status ignore count / text for the visual but keep text as the label when status is set.

Example

/** * Runnable example for Badge. */import { Badge, Button } from '@tetherto/mdk-react-devkit'export const BadgeExample = () => (  <div className="mdk-example-row">    <Badge count={5}>      <Button>Messages</Button>    </Badge>    <Badge count={120} overflowCount={99}>      <Button>Notifications</Button>    </Badge>    <Badge dot>      <Button>Updates</Button>    </Badge>    <Badge status="success" text="Online" />    <Badge status="error" text="Offline" />    <Badge text="NEW" color="primary" square />  </div>)