elements

Badge

Display a short text to represent a status or a category.

Usage

Use the default slot to set the text of the Badge.

Badge

<UBadge>Badge</UBadge>

You can also use the label prop:

Badge
<UBadge label="Badge" />

Style

Use the color and variant props to change the visual style of the Badge.

Badge

<UBadge color="primary" variant="solid" />

Size

Use the size prop to change the size of the Badge.

Badge

<UBadge size="sm" />

Props

Prop Default Description
sizeappConfig.ui.badge.default.sizestring
colorappConfig.ui.badge.default.colorstring
variantappConfig.ui.badge.default.variantstring
labelnullstring
uiappConfig.ui.badgeany

Preset

{
  "base": "inline-flex items-center",
  "rounded": "rounded-md",
  "font": "font-medium",
  "size": {
    "xs": "text-xs px-1.5 py-0.5",
    "sm": "text-xs px-2 py-1",
    "md": "text-sm px-2 py-1",
    "lg": "text-sm px-2.5 py-1.5"
  },
  "variant": {
    "solid": "bg-{color}-50 dark:bg-{color}-400 dark:bg-opacity-10 text-{color}-500 dark:text-{color}-400 ring-1 ring-inset ring-{color}-500 dark:ring-{color}-400 ring-opacity-10 dark:ring-opacity-20"
  },
  "default": {
    "size": "sm",
    "variant": "solid",
    "color": "primary"
  }
}

Made by