Skip to main content

Starwind UI v3.0 beta is now available! Read the migration guide

Introducing Starwind UI v3

Installation

Framework Availability

Astro Available React Available

Badge is available for Astro and React.

Usage

Use tone to choose the semantic color and appearance to choose how strongly that color is presented. They can be combined independently, giving you more control than the original variant prop.

Tone and appearance

The available tones are neutral, primary, primary-accent, secondary, secondary-accent, info, success, warning, and error. Each tone supports solid, soft, outline, text, and frosted appearances.

solid

Neutral
Primary
Primary accent
Secondary
Secondary accent
Info
Success
Warning
Error

soft

Neutral
Primary
Primary accent
Secondary
Secondary accent
Info
Success
Warning
Error

outline

Neutral
Primary
Primary accent
Secondary
Secondary accent
Info
Success
Warning
Error

text

Neutral
Primary
Primary accent
Secondary
Secondary accent
Info
Success
Warning
Error

frosted

Neutral
Primary
Primary accent
Secondary
Secondary accent
Info
Success
Warning
Error

Providing either tone or appearance opts into the composable styling API. When one is omitted, the component uses neutral for the tone or soft for the appearance.

Eyebrow

Use eyebrow for compact labels that need an uppercase treatment with wider letter spacing. It can be combined with every tone, appearance, and size.

Small eyebrow
Medium eyebrow
Large eyebrow

Size and icons

Small
Medium
Large

Provide an href to render the Badge as an <a> element. Link badges receive hover styles suited to their selected appearance.

Legacy variants

The variant prop is still supported to avoid breaking changes. For new usage, prefer tone and appearance, which separate semantic color from visual emphasis. If tone or appearance is provided, the composable styling API takes precedence over variant.

Default
Primary
Secondary
Outline
Ghost
Info
Success
Warning
Error

API Reference

Styled Component API

These props are added or materially changed by the installed Astro styled component. Standard HTML attributes remain available through the inherited interfaces noted below. Follow the Primitive and Runtime links for lower-level behavior props.

Badge

Inherits a attributes. Omits `type`.

Inherits div attributes.

Contains the following additional props:

Prop Type Default Toggle details
appearance "solid" | "soft" | "outline" | "text" | "frosted"
Description
Selects whether the Badge uses solid, soft, outlined, text, or frosted chrome.
Classification
Styled variant
eyebrow boolean false
Description
Applies uppercase tracking for compact eyebrow labels.
Classification
Styled variant
size "sm" | "md" | "lg" "md"
Description
Selects the component's visual size.
Classification
Styled variant
tone "neutral" | "primary" | "primary-accent" | "secondary" | "secondary-accent" | "info" | "success" | "warning" | "error"
Description
Selects the semantic color family used by composed Badge appearances.
Classification
Styled variant
variant "default" | "primary" | "secondary" | "outline" | "ghost" | "info" | "success" | "warning" | "error" "default"
Description
Selects the component's visual variant.
Classification
Styled variant

Changelog

v1.5.0

  • Added contract-generated Astro and React implementations.
  • Added tone, appearance, and eyebrow treatments while preserving the legacy variant API for backwards compatibility.

v1.4.3

  • Refactor tailwind variants functions into separate variants.ts file

v1.4.0

  • Add automatic styling for SVGs within badges

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.