Installation
Add this component to your project using the npui CLI:
npx npui add badge
Variants & Examples
Default Badge
A standard badge for general tagging or categorization.
New
1import { Badge } from "@/components/ui/badge";
2
3export function DefaultBadge() {
4 return <Badge>New</Badge>;
5}
Secondary Badge
A less prominent badge for secondary information.
Beta
1import { Badge } from "@/components/ui/badge";
2
3export function SecondaryBadge() {
4 return <Badge variant="secondary">Beta</Badge>;
5}
Destructive Badge
A badge indicating a warning or error state.
Error
1import { Badge } from "@/components/ui/badge";
2
3export function DestructiveBadge() {
4 return <Badge variant="destructive">Error</Badge>;
5}
Outline Badge
A badge with an outline, often used for alternative styling.
Draft
1import { Badge } from "@/components/ui/badge";
2
3export function OutlineBadge() {
4 return <Badge variant="outline">Draft</Badge>;
5}
Props
These are the available props for the Badge component:
Prop | Type | Description | Default |
---|---|---|---|
variant | "default" | "secondary" | "destructive" | "outline" | The visual style of the badge. | "default" |
children | React.ReactNode | The content of the badge. | - |