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 badgeImports
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
| Prop | Type | Default | Description |
|---|---|---|---|
variant | BadgeVariantValues: default, secondary, outline, danger, success, warning | default | Visual style variant. |
size | BadgeSizeValues: sm, md, lg | md | Badge size. |
Events
No public events documented.
Slots
| Slot | Description |
|---|---|
default | Badge content. |
Styling
Uses Tailwind: yes
Theme tokens:
bg-primarytext-primary-foregroundbg-secondary
Internal selectors:
[data-slot=badge-root]
Registry
Registry source: available.
Add command: zweb add badge
Type: component
Dependencies:
@zeus-web/badgeclass-variance-authority
Registry dependencies:
cnglobals
Files:
templates/react/badge.tsx→components/ui/badge.tsxtemplates/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>
}