About this component
A status badge with a sliding count and configurable content, leading icon, count, and theme.
How it works
- Four variants map to the theme's primary, secondary, destructive, and outline surfaces.
- A full radius, 8 × 2 pt padding, and 12/16 pt medium text keep labels compact. Icons are supplied by the caller.
countcomposesBaseSlidingNumberat 12 pt with a 16 pt line height. The number receives the same theme and foreground color.
Install
npx nativeanimation add base-badgeThe CLI also copies base-theme and base-sliding-number. Dependencies, if you copy by hand:
npx expo install react-native-reanimated react-native-workletsLoad the Geist regular and medium fonts used by the theme once in your app, or supply your own font names in a custom theme.
Usage
import { BaseBadge } from './base-badge';
<BaseBadge variant="secondary">Paid</BaseBadge>
<BaseBadge variant="outline">Refunded</BaseBadge>
<BaseBadge count={unread}>Unread</BaseBadge>Wrap your app in BaseThemeProvider (from base-theme) to choose light/dark and an accent; without it, pieces use the light neutral theme. Every piece also takes a theme prop that wins over the provider.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | Label; strings and numbers receive the badge text style. |
variant | 'default' | 'secondary' | 'destructive' | 'outline' | 'default' | Surface and foreground pair. |
leading | ReactNode | — | Optional 12 pt icon; supply its color to match the variant. |
count | number | — | Animated number after the label, including zero. |
style | StyleProp<ViewStyle> | — | Root view style. |
theme | BaseTheme | provider | Theme override, also passed to the number. |
testID | string | — | Root identifier. |
accessibilityLabel | string | label + count | Explicit name, especially for custom label elements. |
Compatibility
Expo SDK 58 · React Native 0.88 · Reanimated 4.7 · react-native-worklets 0.13. Targets iOS, Android, and web, including Expo Go and development builds. Part of Native Animation Base, a free family sharing one theme; the CLI installs its family dependencies automatically.
Accessibility
The badge is informational, with a single accessible label containing its text and count. Decorative icons and digit wheels are hidden from screen readers. Supply accessibilityLabel for custom label content. BaseSlidingNumber handles Reduce Motion by changing digits immediately. The badge is not a touch target.
Part of a shared foundation
Use it in a screen
Compose Base Badge with other Base components and a single shared theme. Ask your agent to read each API, then connect real navigation, state, and callbacks.
Go further.
Base covers the everyday. Choose a more expressive interaction when your app calls for it.
Stacked Category Cards ↗
A category stack whose tabs unfold into detail cards, with configurable categories, title, colors, and fonts.
Another way to solve this task · $9Review Approval Card ↗
A moderation queue with swipe-to-approve or decline feedback, with configurable reviews, labels, colors, and fonts.
Source code
Loading public source…









