Sections
Get Started
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Pagination
- Pin Input
- Popover
- Progress
- Radio Group
- Range Calendar
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stepper
- Switch
- Table
- Tabs
- Tags Input
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Forms
Badge
Secondary
Destructive
Outline
Verified
8
99
20+
<script setup lang="ts">
import { BadgeCheckIcon } from 'lucide-vue-next'
import { Badge } from '@/components/ui/badge'
</script>
<template>
<div class="flex flex-col items-center gap-2">
<div class="flex w-full flex-wrap gap-2">
<Badge>Badge</Badge>
<Badge variant="secondary">
Secondary
</Badge>
<Badge variant="destructive">
Destructive
</Badge>
<Badge variant="outline">
Outline
</Badge>
</div>
<div class="flex w-full flex-wrap gap-2">
<Badge
variant="secondary"
class="bg-blue-500 text-white dark:bg-blue-600"
>
<BadgeCheckIcon />
Verified
</Badge>
<Badge class="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums">
8
</Badge>
<Badge
class="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums"
variant="destructive"
>
99
</Badge>
<Badge
class="h-5 min-w-5 rounded-full px-1 font-mono tabular-nums"
variant="outline"
>
20+
</Badge>
</div>
</div>
</template>Installation
pnpm dlx shadcn-vue@latest add badge
Usage
<script setup lang="ts">
import { Badge } from '@/components/ui/badge'
</script>
<template>
<Badge variant="default | outline | secondary | destructive">
Badge
</Badge>
</template>Link
You can use the as-child prop to make another component look like a badge. Here's an example of a link that looks like a badge.
<script setup lang="ts">
import { Badge } from '@/components/ui/badge'
</script>
<template>
<Badge as-child>
<a href="#">Badge</a>
</Badge>
</template>