--- title: Badge description: A small visual indicator used to highlight an item, indicate status, or emphasize information. --- ## Installation CLI Manual ```bash npx lightswind@latest add badge ``` Copy and paste the following code into your project. ```tsx import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/components/lib/utils" const badgeVariants = cva( "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", { variants: { variant: { default: "badge-3d-default", secondary: "badge-3d-secondary", destructive: "badge-3d-destructive", outline: "badge-3d-outline", success: "badge-3d-success", warning: "badge-3d-warning", info: "badge-3d-info", unstyled: "", }, size: { default: "px-2.5 py-0.5 text-xs", sm: "px-2 py-0.5 text-xs", lg: "px-3 py-1 text-sm", unstyled: "", }, shape: { default: "rounded-full", square: "rounded-sm", rounded: "rounded-md", unstyled: "", } }, defaultVariants: { variant: "default", size: "default", shape: "default", }, } ) export interface BadgeProps extends React.HTMLAttributes, VariantProps { withDot?: boolean; dotColor?: string; interactive?: boolean; highlighted?: boolean; } function Badge({ className, variant, size, shape, withDot, dotColor = "currentColor", interactive, highlighted, ...props }: BadgeProps) { return (
{withDot && ( )} {props.children}
) } export { Badge, badgeVariants } ```
## Usage ```tsx import { Badge } from "@/components/lightswind/badge" ``` ```tsx import { Badge } from "@/components/lightswind/badge"; export function BadgeDemo() { return New; } ```