Badge

free

Badge adds low-noise counts or status markers to controls, rows, and labels.

6
import { PiBell } from 'react-icons/pi'
import Badge from '@/components/ui/badge';
import Button from '@/components/ui/button';

Installation

Add this component with the NateUI CLI.

npx nateui@latest add Badge

Examples

Basic

9New
import { PiUser } from 'react-icons/pi'
import Avatar from '@/components/ui/avatar';
import Badge from '@/components/ui/badge';

Inline

999New
import Badge from '@/components/ui/badge';

export default function InlineDemo() {
  return (

Count Overflow

9+99+
import { PiUser } from 'react-icons/pi'
import Avatar from '@/components/ui/avatar';
import Badge from '@/components/ui/badge';

Dot

import { PiUser } from 'react-icons/pi'
import Avatar from '@/components/ui/avatar';
import Badge from '@/components/ui/badge';

Placement

33
import { PiUser } from 'react-icons/pi'
import Avatar from '@/components/ui/avatar';
import Badge from '@/components/ui/badge';
import Button from '@/components/ui/button';

API

Badge accepts the props below plus native props for the root span.

PropDescriptionTypeDefault
badgeStyleInline style applied to the badge indicator element. Positional styles override the generated placement classes.CSSProperties-
childrenElement the badge indicator is attached to. When omitted, Badge renders inline.ReactNode-
classNameClass names applied to the wrapper when children are present, or to the badge itself when inline.string-
contentCount or label displayed inside the badge. Omit it to render a dot indicator.string | number-
innerClassClass names applied to the indicator element for custom color or sizing.string-
maxCountMaximum number to display before showing a + suffix.number99
overlapGeometry model used when the badge overlaps a child element. Match the target shape: square, round, or circle.BadgeOverlap'round'
placementCorner where the badge indicator is anchored when children are present.BadgePlacement'bottom-end'
refRef forwarded to the root span.Ref<HTMLSpanElement>-
...nativeSpanPropsNative props for the root span.NativeBadgeSpanProps-

Types

type BadgePlacement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
type BadgeOverlap = 'square' | 'round' | 'circle';
type NativeBadgeSpanProps = Omit<ComponentProps<'span'>, 'content'>;