Skip to content

Badge

Non-interactive status indicators and category labels. Use to draw attention to new, changed, or important content.


Demo

Variants

NeutralInformationGodkendtAfventerAfvist

With dot

AktivAfventerOfflineI gangKladde

Sizes

SmallMediumSmall dotMedium dot

With icon

BekræftetFjernet

In context (card metadata)

Design6 min read

When to use

  • Show status of an item (active, pending, rejected, approved)
  • Label categories in cards, lists, or tables
  • Highlight new or updated content

When not to use

  • As a clickable element — badges are not buttons or links
  • Where placement might make users think it is a button (test for this)
  • On pages with dynamic content where recency is already obvious (e.g. newest on top)
  • To mark too many items — use badges sparingly where truly meaningful

Installation

bash
pnpm add @grundtone/vue

Usage

Basic

vue
<template>
  <GTBadge>Default</GTBadge>
  <GTBadge variant="success">Godkendt</GTBadge>
  <GTBadge variant="error">Afvist</GTBadge>
</template>

With dot indicator

vue
<template>
  <GTBadge variant="success" dot>Aktiv</GTBadge>
  <GTBadge variant="warning" dot>Afventer</GTBadge>
  <GTBadge variant="error" dot>Offline</GTBadge>
</template>

With icon

vue
<template>
  <GTBadge variant="success" icon="check">Bekræftet</GTBadge>
</template>

Sizes

vue
<template>
  <GTBadge size="sm">Small</GTBadge>
  <GTBadge size="md">Medium</GTBadge>
</template>

In card metadata

vue
<template>
  <div class="meta text-sm text-secondary">
    <GTBadge size="sm" variant="info">Design</GTBadge>
    <time>19 March 2026</time>
    <span>6 min read</span>
  </div>
</template>

Props

PropTypeDefaultDescription
variant'info' | 'success' | 'warning' | 'error' | 'neutral''neutral'Visual variant
size'sm' | 'md''md'Size
iconstringIcon name from the registry (renders GTIcon)
dotbooleanfalseShow a colored dot indicator
ariaLabelstringAccessible label (overrides slot text)

Slots

SlotDescription
defaultBadge text content

Accessibility

  • Renders as <span> — non-interactive, no button or link semantics
  • aria-label overrides visible text for screen readers when provided
  • Dot is decorative (aria-hidden="true")
  • Do not rely on color alone to convey meaning — pair with descriptive text (WCAG 1.4.1)

CSS Classes

ClassElement
.gt-badgeRoot container
.gt-badge--neutralNeutral variant
.gt-badge--infoInfo variant
.gt-badge--successSuccess variant
.gt-badge--warningWarning variant
.gt-badge--errorError variant
.gt-badge--smSmall size
.gt-badge--mdMedium size
.gt-badge__dotDot indicator
.gt-badge__iconIcon element

Design system

The CSS-only version of this component is documented in the Design System — Badge reference.