rslabdocs

Notification Badge

A count or dot overlaid on any icon, popping in and bumping with every change.

ReanimatedNativeWindSource

Prerequisites

Just Reanimated for the pop/bump animations.


npx expo install react-native-reanimated

Install


npx @rslab/cli add notification-badge

Usage


import { NotificationBadge } from '@/components/ui/NotificationBadge';



const [count, setCount] = useState(3);



<NotificationBadge count={count}>

  <BellIcon />

</NotificationBadge>



<NotificationBadge dot>

  <MailIcon />

</NotificationBadge>

Pass color to match the badge to your palette:

<NotificationBadge count={2} color="#0ea5e9">
  <MailIcon />
</NotificationBadge>

Props

PropTypeDefault
children
React.ReactNode
-

The wrapped element the badge overlays, e.g. an icon.

count?
number
-

Shown as a number when > 0. Capped at "9+" past 9.

dot?
boolean
false

Shows a plain dot when there's no meaningful count to display.

color?
string
'#ef4444'

Badge background color.

className?
string
-

Extend or override the outer wrapper.

See exactly how this works with an RSLAB subscription.

Get Pro

On this page