Skip to content

@vibe-labs/design-vue-badges

Vue 3 badge components for the Vibe Design System. Provides label badges, notification counts, and status dots.

Installation

ts
import { VibeBadge, VibeBadgeCount, VibeDot } from "@vibe-labs/design-vue-badges";

Requires the CSS layer from @vibe-labs/design-components-badges.

Components

VibeBadge

Label badge with variant styling, auto-color generation, and optional dismiss button.

Usage

vue
<!-- Basic -->
<VibeBadge label="New" />

<!-- Variants -->
<VibeBadge label="Active" variant="success" />
<VibeBadge label="Warning" variant="warning-subtle" />
<VibeBadge label="Outline" variant="outline" />

<!-- Auto-colored genre pills -->
<VibeBadge label="Electronic" auto-color />
<VibeBadge label="Jazz" auto-color />
<VibeBadge label="Hip Hop" auto-color />

<!-- Custom colors -->
<VibeBadge label="Custom" bg-color="#ff6b6b" />

<!-- Interactive -->
<VibeBadge label="Click me" interactive @click="handleClick" />

<!-- Dismissible -->
<VibeBadge label="Removable" dismissible @dismiss="handleRemove" />

<!-- With icons -->
<VibeBadge label="Tagged">
  <template #left><TagIcon /></template>
</VibeBadge>

<!-- Sizes -->
<VibeBadge label="Small" size="sm" />
<VibeBadge label="Large" size="lg" />

<!-- Shape -->
<VibeBadge label="Square" :pill="false" square />

Props

PropTypeDefaultDescription
labelstringrequiredBadge text content
variantBadgeVariant"accent-subtle"Visual variant
sizeBadgeSize"md"sm · md · lg
pillbooleantrueFull border radius
squarebooleanfalseSmall border radius
interactivebooleanfalseButton role + hover state
dismissiblebooleanfalseShow remove button, emit dismiss
autoColorbooleanfalseDeterministic color from label text
bgColorstringOverride background color
fgColorstringOverride text color (auto-contrasted from bgColor)

Events

EventPayloadDescription
dismissRemove button clicked

Slots

SlotDescription
leftLeading icon
rightTrailing icon (hidden when dismissible)
dismiss-iconCustom dismiss button content (default: ×)

VibeBadgeCount

Notification count badge — works standalone (inline) or anchored to a child element.

Usage

vue
<!-- Inline count -->
<VibeBadgeCount :count="5" />

<!-- Overflow -->
<VibeBadgeCount :count="150" :max="99" />
<!-- Renders: "99+" -->

<!-- Anchored to an icon/button -->
<VibeBadgeCount :count="3">
  <BellIcon />
</VibeBadgeCount>

<!-- Pulse on change -->
<VibeBadgeCount :count="unreadCount" pulse />

<!-- Hide when zero (default) -->
<VibeBadgeCount :count="0" />
<!-- Renders nothing -->

<!-- Show zero -->
<VibeBadgeCount :count="0" :hide-zero="false" />

<!-- Custom styling -->
<VibeBadgeCount :count="7" variant="accent" bg-color="#7c5cff" />

Props

PropTypeDefaultDescription
countnumberrequiredThe count to display
maxnumber99Overflow threshold (shows max+)
variantBadgeVariant"danger"Visual variant
sizeBadgeSize"sm"Size preset
hideZerobooleantrueHide badge when count is 0
pulsebooleanfalsePulse animation on count change
bgColorstringOverride background color
fgColorstringOverride text color

Slots

SlotDescription
defaultAnchor element — when provided, count positions as superscript

VibeDot

Minimal status dot indicator.

Usage

vue
<!-- Basic -->
<VibeDot />

<!-- Variants -->
<VibeDot variant="success" aria-label="Online" />
<VibeDot variant="danger" aria-label="Error" />

<!-- Pulsing (live indicator) -->
<VibeDot variant="success" pulse aria-label="Live" />

<!-- Custom color -->
<VibeDot color="#ff6b6b" aria-label="Custom status" />

Props

PropTypeDefaultDescription
variantBadgeVariant"accent"Visual variant
colorstringOverride dot color
pulsebooleanfalsePulsing animation
ariaLabelstringAccessible label (sets role="img", otherwise presentation)

Dependencies

PackagePurpose
@vibe-labs/coreColorFromString for auto-color and contrast
@vibe-labs/design-components-badgesCSS tokens + generated styles

Build

bash
npm run build

Built with Vite + vite-plugin-dts. Outputs ES module with TypeScript declarations.