Pittaya UI
Pittaya UI
Links

Search Components

Search for components by name, description, category or tags

Componentsstable

Badge

A versatile badge component for displaying status, labels, or metadata with multiple visual variants.

Stable

Installation

Install the component directly into your project using the Pittaya CLI.

npx pittaya@latest add badge

When to use

Use badges to highlight important information, display statuses, categorize content, or draw attention to specific metadata. They are perfect for labels, counts, notifications, and status indicators.

Badges work well in tables, cards, lists, and navigation elements where you need to convey supplementary information without taking up too much space.

Best practices

  • Keep badge text concise—use 1-3 words maximum for better readability.
  • Use consistent color coding across your application (e.g., green for success, red for errors).
  • Choose the stable variant for approved or production-ready states, beta for experimental features, and deprecated for outdated content.
  • Combine badges with icons to enhance recognition and provide visual context.
  • Avoid overusing badges—too many can create visual clutter and reduce their effectiveness.

Accessibility

The Badge component uses semantic HTML with proper focus states and color contrast ratios. When using badges to convey status information, ensure the meaning is not communicated solely through color.

If using badges as interactive elements (links), the asChild prop allows you to render them as anchor tags while maintaining proper keyboard navigation and screen reader support.

Examples

Combine variants and sizes to meet your needs.

All variants

Demonstration of all available badge variants for different use cases.

DefaultSecondaryOutlineDestructiveStableBetaDeprecated

With icons

Combine badges with icons to provide additional visual context and improve recognition.

ApprovedIn ProgressFailed

Properties

TSX interface that combines variants and default attributes.

PropTypeDefaultDescription
variant
'default' | 'secondary' | 'destructive' | 'outline' | 'stable' | 'beta' | 'deprecated''default'Defines the visual style of the badge. Choose variants based on the type of information being conveyed.
asChild
booleanfalseWhen enabled, uses Radix's Slot to merge styles with the child element, allowing you to render badges as links or other interactive elements.