Reference version

This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 55).

Badge

A Jetpack Compose Badge component for displaying status indicators and counts.

Android

Expo UI Badge matches the official Jetpack Compose Badge API. It renders as a small colored indicator dot, or with content such as a count number.

Installation

Terminal
npx expo install @expo/ui

If you are installing this in an existing React Native app, make sure to install expo in your project.

Usage

Indicator dot

A badge with no children renders as a small dot indicator.

BadgeDot.tsx
import { Host, Badge } from '@expo/ui/jetpack-compose'; export default function BadgeDot() { return ( <Host matchContents> <Badge /> </Host> ); }

Badge with count

Pass a Text child to display a number or label.

BadgeCount.tsx
import { Host, Badge, Text } from '@expo/ui/jetpack-compose'; export default function BadgeCount() { return ( <Host matchContents> <Badge containerColor="#EF5350" contentColor="#FFFFFF"> <Text>3</Text> </Badge> </Host> ); }

API

import { Badge } from '@expo/ui/jetpack-compose';

Component

Badge

Android

Type: React.Element<BadgeProps>

A badge component matching Compose's Badge. Renders as a small colored indicator dot, or with content (for example, a count).

BadgeProps

children

Android
Optional • Type: React.ReactNode

Optional content inside the badge (for example, a Text with a count). When omitted, renders as a small indicator dot.

containerColor

Android
Optional • Type: ColorValue • Default: BadgeDefaults.containerColor

Background color of the badge.

contentColor

Android
Optional • Type: ColorValue • Default: BadgeDefaults.contentColor

Content color inside the badge (text/icon tint).

modifiers

Android
Optional • Type: ModifierConfig[]

Modifiers for the component.