Skip to content

Badge

WxBadge is the small label that says what something is: a status, a section, a tag on a row. For a count pinned to a button or an icon, use Indicator instead.

Soft — the default
defaultprimarysuccesswarningdangerinfo
Solid
defaultprimarysuccesswarningdangerinfo
Outline
defaultprimarysuccesswarningdangerinfo
Status dots and sizes
PublishedPending reviewDraftsmmdlg
Closable
NewsReleasesGuides

Usage

vue
<template>
  <wx-badge type="success">Published</wx-badge>
  <wx-badge type="warning" variant="outline">Pending review</wx-badge>
  <wx-badge type="default" dot round>Draft</wx-badge>
</template>

Statuses

A badge with dot reads as a state rather than a tag — the dot carries the colour, so the label stays legible at a glance in a dense table:

vue
<template>
  <wx-badge type="success" dot round>Published</wx-badge>
</template>

Removable tags

closable adds a ×. The badge does not remove itself — it emits close and the list stays yours:

vue
<script setup lang="ts">
import { ref } from 'vue'

const tags = ref(['News', 'Releases'])
</script>

<template>
  <wx-badge v-for="tag in tags" :key="tag" closable @close="tags = tags.filter((t) => t !== tag)">
    {{ tag }}
  </wx-badge>
</template>

Props

PropTypeDefaultDescription
type'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info''default'Semantic colour
variant'soft' | 'solid' | 'outline''soft'Visual weight
size'sm' | 'md' | 'lg''md'Padding and text size
roundbooleanfalsePill shape
dotbooleanfalseColoured dot before the label
closablebooleanfalseAdds a × that emits close
closeLabelstring'Remove'Accessible name of the close button

Events: close (MouseEvent).

Slots: default — the label; icon — sits before the label.

Released under the MIT License.