Docs
Badge
Badge
Displays a brutal retro badge or a component that looks like a badge.
Loading...
Installation
Copy and paste the following code into your project.
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const badgeVariants = cva(
"inline-flex items-center px-4 py-2 text-xs font-semibold transition-colors focus:outline-none relative after:absolute after:bottom-0 after:left-0 after:h-[2px] after:w-0 after:bg-primary after:transition-all after:duration-300 hover:after:w-full",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground after:bg-white dark:after:bg-black",
secondary: "border-transparent bg-secondary text-secondary-foreground",
destructive:
"border-transparent bg-destructive text-destructive-foreground",
outline: "text-foreground",
},
},
defaultVariants: {
variant: "default",
},
}
)
export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) {
return (
<div className={cn(badgeVariants({ variant }), className)} {...props} />
)
}
export { Badge, badgeVariants }
Copy and paste the badge code into your project.
Other Styles
Secondary
Loading...
Outline
Loading...
Destructive
Loading...