SwipeUI

Badge

A compact status or count label with semantic tones.

npx @swipeui/cli add badge
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Status labels such as New, Beta, Paid or Overdue.
  • Counts on icons or list rows, such as 3 unread.
  • Small category tags in cards.

When not to use it

  • Tappable filters. Use Chip.
  • Longer messages. Use Alert.
  • Tab bar badges; tab bars draw their own from tabBarBadge.

Installation

Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.

npx @swipeui/cli add badge
  • Adds components/swipeui/ui/badge.tsx and 2 shared helpers.
  • Installs class-variance-authority, uniwind, clsx, tailwind-merge. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/inbox.tsx
import { Badge } from '@/components/swipeui/ui/badge';

<Badge>New</Badge>
<Badge variant="destructive" accessibilityLabel="3 new messages">3</Badge>

Variants are default (bg-primary), secondary, destructive and outline.

API reference

PropTypeDefaultDescription
childrenReactNode—

The content. Strings and numbers are wrapped in Text.

variant?BadgeVariant'default'

The visual style.

className?string—

Classes merged over the variant.

textClassName?string—

Classes for the label text.

soft?booleanfalse

Softer semantic surface.

dot?booleanfalse

Leading status dot; the label still carries meaning.

textTone?"dark" | "light"'dark'

The label's tone on the saturated destructive fill: dark for the stronger contrast, or light for a white count.

style?StyleProp<ViewStyle>—

Style escape hatch for the container.

The other View props pass through.

Composition and behavior

  • children is the label or count.
  • variant is default, secondary, destructive, outline, success, warning or info.
  • textClassName styles the text.

Feedback lineup settings

PropDoes / default
childrenThe content. Strings and numbers are wrapped in Text.
variantThe visual style. @default 'default'
classNameClasses merged over the variant.
textClassNameClasses for the label text.
softSofter semantic surface. @default false
dotLeading status dot; the label still carries meaning. @default false
textToneThe label's tone on the saturated destructive fill: dark for stronger contrast, or light for a white count. @default 'dark'
styleStyle escape hatch for the container.

Filled destructive badges use a saturated colour derived from the destructive token, with a dark foreground from the existing theme. Soft badges retain their semantic tint. Explicit caller styles still win.

Behavior and gestures

  • Static; it doesn't respond to touch.

Accessibility

  • Give counts an accessibilityLabel that says what they count, such as "3 new messages"; a bare number means little.
  • Status words are read as written.
  • Tones come with text, so colour is never the only signal.

Motion

  • Static on its own; any movement comes from the parent that animates it.
  • Static.

Performance

  • A tiny view with text; free to use in lists.

Notes for AI

  • Choose the variant for meaning: destructive for errors, success, warning, info.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items