Skip to content

Badge ​

Styled badge component built on the zw-badge primitive.

@zeus-web/badgeData Displayzweb add badgeGenerated

Playground ​

Source ​

Choose the framework entry that matches your application.

html
<script type="module">
  import '@zeus-web/badge/wc/auto'
</script>

<zw-badge variant="secondary">Beta</zw-badge>
tsx
import { Badge } from '@zeus-web/badge/react'

export function BadgeExample() {
  return <Badge variant="secondary">Beta</Badge>
}
vue
<script setup lang="ts">
import { Badge } from '@zeus-web/badge/vue'
</script>

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

Add ​

bash
zweb add badge

Imports ​

Styled registry component:

tsx
import { Badge } from '@/components/ui/badge'

Primitive React wrapper:

tsx
import { Badge } from '@zeus-web/badge/react'

Web Component entry:

ts
import '@zeus-web/badge/wc/auto'

Props ​

PropTypeDefaultDescription
variantBadgeVariant
Values: default, secondary, outline, danger, success, warning
defaultVisual style variant.
sizeBadgeSize
Values: sm, md, lg
mdBadge size.

Events ​

No public events documented.

Slots ​

SlotDescription
defaultBadge content.

Styling ​

Uses Tailwind: yes

Theme tokens:

  • bg-primary
  • text-primary-foreground
  • bg-secondary

Internal selectors:

  • [data-slot=badge-root]

Registry ​

Registry source: available.

Add command: zweb add badge

Type: component

Dependencies:

  • @zeus-web/badge
  • class-variance-authority

Registry dependencies:

  • cn
  • globals

Files:

  • templates/react/badge.tsx → components/ui/badge.tsx
  • templates/vue/badge.ts → components/ui/badge.ts

AI usage rules ​

Do:

  • Use Badge for status labels and counts.

Do not:

  • Do not use Badge as a clickable button.

Examples ​

React styled usage ​

tsx
import { Badge } from '@/components/ui/badge'

export function Example() {
  return <Badge>New</Badge>
}

Released under the MIT License.