Kinetik UI

Count Badge

.md

A count on the corner of an icon that springs in, jumps as it rises, rolls its number and shrinks away at zero.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add count-badge

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/count-badge.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/count-badge.tsx
    View source files

Usage

import { CountBadge } from '@/components/kinetik/count-badge';

<CountBadge count={unread} formatLabel={(n) => `${n} unread`}>
  <InboxIcon />
</CountBadge>;

When to use

  • Unread messages, new notifications, items in a cart: a count that changes while people watch.
  • A presence or "something new" dot with dot.

When not to use

  • Static labels or categories. Use a plain tag.
  • Counts so large they stop meaning anything; prefer a dot, or cap with max.

Notes

  • The badge springs in for the first item, jumps when the count rises, rolls the number up or down, and shrinks away at zero.
  • It reads its own label (formatLabel) for screen readers; give the element underneath its own name too.
  • ringColor should match what is behind the anchor so the badge looks cut out of it.
  • With reduced motion the number changes in place, without the jump.

Props

CountBadgeProps

PropTypeDefaultDescription
countrequirednumber—
childrenrequiredReactNode—What sits under the badge: an icon, an avatar, a tab.
maxnumber99Above this the badge shows "99+". Defaults to 99.
dotbooleanfalseA plain dot instead of a number.
tone'danger' | 'azure''danger'Defaults to "danger".
formatLabel(count: number) => string(n) => `${n} new`Read by screen readers, e.g. (n) => `${n} unread`. Defaults to "n new".
ringColorstring—The colour around the badge that cuts it out from what is under it. Defaults to the theme background.
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One small view and three shared values; it animates only when the count changes. Nothing runs at rest.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.17× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 146 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The number changes in place without the jump; the badge still appears and disappears.
Screen readers
The badge reads its label, such as "3 unread"; it is hidden at zero.
Touch target
Not interactive; the element under it keeps its own target.

Source files

components/kinetik/count-badge.tsx is in the Code tab of the preview above.