Badge

Displays a badge or a component that looks like a badge.

Preview ​

Installation ​

npx sigma-ui@latest add badge

Usage ​

vue
<script setup lang="ts">
import { Badge } from '@/components/ui/badge';
</script>

<template>
  <Badge variant="secondary">
    Badge
  </Badge>
</template>

Set variant to default, secondary, outline, or destructive. To give another element the badge styles, use badgeVariants:

vue
<script setup lang="ts">
import { badgeVariants } from '@/components/ui/badge';
</script>

<template>
  <a
    href="/changelog"
    :class="badgeVariants({ variant: 'outline' })"
  >
    New
  </a>
</template>

Examples ​

Default ​

Secondary ​

Outline ​

Destructive ​

API Reference ​

Badge ​

Props

PropType Default
variant

Visual style of the badge.

"default" | "destructive" | "secondary" | "outline" | null-

Slots

SlotScope
default

The content of the component.

-

Accessibility ​

Renders a plain div with no role. It has no keyboard interactions of its own.

KeyDescription
NoneThe badge is not focusable. If you render it as a link or button with badgeVariants, that element keeps its native keyboard behaviour.
Edit this page on GitHub