Skip to main content

Starwind UI v1.12 is now available!

Badge

Badge

Installation

The Badge component can also function as a link (<a> tag) by providing an href prop.

Usage

variant

default
primary
secondary
outline
ghost
info
success
warning
error

size

small
medium
large

API Reference

Badge

A versatile badge component with multiple variants and sizes.

PropTypeDefault
variant"default" | "primary" | "secondary" | "outline" | "ghost" | "info" | "success" | "warning" | "error""default"
size"sm" | "md" | "lg""md"
hrefstring-
classstring-
<Badge variant="default" size="md">Badge</Badge>

Additional Notes:

  • href: When provided, renders the badge as a link (<a> tag) instead of a <div>

Changelog

v1.3.0

  • style and focus state updates

v1.2.0

  • Add a data-slot attribute to all components to enable global styling updates

v1.1.1

  • Adjust component to use type VariantProps from tailwind-variants. This provides greater type safety and cleans up component frontmatter.

v1.1.0

  • tailwind-variants now implemented. This uses tailwind-merge under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the “class” prop.