Badge
Compact ARCUI dot or label badge for supplementary status, count, and navigation metadata.
Badge has two mutually exclusive public modes: a decorative dot and a compact text/number label.
Usage
import { Badge } from "react-native-arc-ui";
<Badge />
<Badge label="New" />The public type is discriminated: dot-only sizing props and label text-color props cannot be mixed accidentally.
Dot badge
<Badge /> and <Badge dot /> both render dot mode because label presence is the actual semantic discriminator.
<Badge />
<Badge dot size={8} />size controls dot width/height and ARCUI resolves a circular radius from that final size.
Malformed per-instance sizes fall back safely to tokens.sizings.badge.dotSize.
Label badge
<Badge label="Beta" />
<Badge label={3} />
<Badge label={0} />label accepts string | number. Numeric 0 and an empty string are still label-mode values because only label === undefined selects dot mode.
Label geometry grows with ARCUI-managed font scaling so larger accessibility text does not get clipped by a fixed badge height.
Background color
Background ownership priority is explicit:
color
-> complete darkColor + lightColor pair
-> badge theme tokens<Badge color="rgba(52,120,246,1)" />
<Badge
label="Beta"
darkColor="rgba(129,85,231,1)"
lightColor="rgba(52,120,246,1)"
/>An incomplete theme pair is ignored; both values must be present to own the theme-aware background.
Label text color
Label mode has a separate priority:
textColor
-> complete darkTextColor + lightTextColor pair
-> badge text tokens<Badge
label="Ready"
color="rgba(20,20,20,1)"
textColor="white"
/>Dot badges intentionally do not accept text-color props.
Native View surface
Badge inherits ViewProps apart from its owned children contract. Use native style, accessibility props, pointer events, and layout props as normal.
For label mode, style applies to the badge container; typography is ARCUI-owned rather than supplied as arbitrary child text.
Testing
With testID="status-badge":
dot badge: status-badge
label badge: status-badge
status-badge-textThe -text descendant exists only in label mode.
For provider setup and react-native-arc-ui/testing, see Testing.
API Reference
Dot Badge
Also inherits: Omit<ViewProps, "children">
| Prop | Type | Default | Description |
|---|---|---|---|
| color? | string | — | — |
| darkColor? | string | — | — |
| lightColor? | string | — | — |
| dot? | true | — | — |
| size? | number | — | Diameter of the dot. Falls back to tokens.sizings.badge.dotSize. |
Label Badge
Also inherits: Omit<ViewProps, "children">
| Prop | Type | Default | Description |
|---|---|---|---|
| color? | string | — | — |
| darkColor? | string | — | — |
| lightColor? | string | — | — |
| dot? | false | — | — |
| label | string | number | required | — |
| textColor? | string | — | — |
| darkTextColor? | string | — | — |
| lightTextColor? | string | — | — |
Generated from the ARCUI 1.1.x TypeScript source snapshot. Native inherited props remain available through the referenced React Native surface.
Motion
Badge does not animate semantic state of its own. Theme-aware background/text colors interpolate with ARCUI theme progress, and label dimensions/font size follow the central font-scale SharedValue.
Performance
Badge is intentionally small: no React state, no timers, no gesture lifecycle. Theme/font-scale interpolation stays within ARCUI's shared visual infrastructure.
Accessibility
Badge is supplementary metadata. Decide whether it should be independently exposed or incorporated into surrounding accessible text based on the product meaning.
A label badge contains native Text content; a dot has no inherent spoken meaning. Do not rely on a bare dot to communicate a critical state to screen-reader users.
Theming
Relevant token areas include:
colors.*.badge
sizings.badge
radius.badge
typography.badge
typography.maxFontSizeMultiplier