Every example is a complete Vue file. Copy it into an app that has the registry installed, or open it in StackBlitz.
Status in a list
One label per row, in the status role that matches: info, success, warning, danger or neutral.
- Orders to ERP
- Stock from warehouse
- Customers to CRM
- Invoices to accounting
- Price list
BadgeStatus.vue
<script setup lang="ts">
import { Badge } from '@/components/ui/badge'
const syncs = [
{ name: 'Orders to ERP', status: 'Synced', variant: 'success' },
{ name: 'Stock from warehouse', status: 'Syncing', variant: 'info' },
{ name: 'Customers to CRM', status: 'Partial', variant: 'warning' },
{ name: 'Invoices to accounting', status: 'Failed', variant: 'danger' },
{ name: 'Price list', status: 'Paused', variant: 'neutral' },
] as const
</script>
<template>
<ul class="m-0 flex w-full max-w-100 list-none flex-col p-0">
<li
v-for="sync in syncs"
:key="sync.name"
class="flex items-center justify-between border-b-(length:--bh-border-width-default) border-(--bh-color-border) py-(--bh-space-100) [font:var(--bh-font-body-default)]"
>
{{ sync.name }}
<Badge :variant="sync.variant">{{ sync.status }}</Badge>
</li>
</ul>
</template>Sizes and plain labels
Default is 20 px, lg 24 px. brand marks something new; the default label has no status colour.
BadgeSizes.vue
<script setup lang="ts">
import { Badge } from '@/components/ui/badge'
</script>
<template>
<div class="flex flex-wrap items-center gap-(--bh-space-200)">
<Badge variant="success">Synced</Badge>
<Badge variant="success" size="lg">Synced</Badge>
<Badge variant="brand">Early access</Badge>
<Badge>Draft</Badge>
</div>
</template>State label
size="state": the one solid label on a page, next to the title, for the status the page is about. It has an icon, so the status does not rely on colour.
Order #10482
Order #10475
BadgeState.vue
<script setup lang="ts">
import { CircleCheck, CircleX } from '@lucide/vue'
import { Badge } from '@/components/ui/badge'
</script>
<template>
<div class="flex flex-col gap-(--bh-space-200)">
<div class="flex items-center gap-(--bh-space-150)">
<h3 class="m-0 text-(--bh-color-text) [font:var(--bh-font-heading-medium)]">Order #10482</h3>
<Badge variant="success" size="state"><CircleCheck aria-hidden="true" />Synced to ERP</Badge>
</div>
<div class="flex items-center gap-(--bh-space-150)">
<h3 class="m-0 text-(--bh-color-text) [font:var(--bh-font-heading-medium)]">Order #10475</h3>
<Badge variant="danger" size="state"><CircleX aria-hidden="true" />Sync failed</Badge>
</div>
</div>
</template>