Workflow state
Show whether a review is pending, approved, or blocked beside its title.
Components / Display
A compact status or category label.
Show whether a review is pending, approved, or blocked beside its title.
Pair a category label with a count in a table cell or list row.
<script setup lang="ts">
import Badge from './components/ui/badge/Badge.vue'
</script>
<template>
<Badge>New</Badge>
<Badge variant="secondary" aria-label="Draft, 3 items">
Draft
<template #suffix><span aria-hidden="true">3</span></template>
</Badge>
<Badge variant="success">
<template #prefix>
<span aria-hidden="true" class="size-1.5 rounded-full bg-current" />
</template>
Live
</Badge>
<Badge variant="warning">Pending</Badge>
<Badge variant="destructive">Blocked</Badge>
<Badge variant="outline">Preview</Badge>
</template>Use a word as well as color to communicate the state.
<script setup lang="ts">
import Badge from './components/ui/badge/Badge.vue'
</script>
<template>
<p>Change request <Badge variant="warning">Awaiting review</Badge></p>
</template>A suffix can hold a decorative count when the accessible name carries the full meaning.
<script setup lang="ts">
import Badge from './components/ui/badge/Badge.vue'
</script>
<template>
<Badge variant="secondary" aria-label="3 unread messages">
Unread <template #suffix><span aria-hidden="true">3</span></template>
</Badge>
</template>The most useful props, models, slots, events, and methods for this component.
| Name | Type | Default or requirement |
|---|---|---|
variant | default | secondary | outline | success | warning | destructive | default |
Add text or decorative icons with the prefix and suffix slots. Each slot also has a data-slot attribute for custom styling.