Badge
neobrutalism-components/badgeFreeComponent
Neobrutalism Components publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by Neobrutalism Components on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.neobrutalism.dev/r/badge.jsonSource
1import { Slot } from "@radix-ui/react-slot"2import { cva, type VariantProps } from "class-variance-authority"34import * as React from "react"56import { cn } from "@/lib/utils"78const badgeVariants = cva(9 "inline-flex items-center justify-center rounded-base border-2 border-border px-2.5 py-0.5 text-xs font-base w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] overflow-hidden",10 {11 variants: {12 variant: {13 default: "bg-main text-main-foreground",14 neutral: "bg-secondary-background text-foreground",15 },16 },17 defaultVariants: {18 variant: "default",19 },20 },21)2223function Badge({24 className,25 variant,26 asChild = false,27 ...props28}: React.ComponentProps<"span"> &29 VariantProps<typeof badgeVariants> & {30 asChild?: boolean31 }) {32 const Comp = asChild ? Slot : "span"3334 return (35 <Comp36 data-slot="badge"37 className={cn(badgeVariants({ variant }), className)}38 {...props}39 />40 )41}4243export { Badge, badgeVariants }
Files it writes
More from Neobrutalism Components
All 92 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | Neobrutalism Components | Components | Free | 1 dep | |
| Alertalert | Neobrutalism Components | Components | Free | no deps | |
| Alert dialogalert-dialog | Neobrutalism Components | Components | Free | 1 dep | |
| Avataravatar | Neobrutalism Components | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | Neobrutalism Components | Components | Free | 1 dep | |
| Buttonbutton | Neobrutalism Components | Components | Free | 1 dep | |
| Calendarcalendar | Neobrutalism Components | Components | Free | 2 deps | |
| Cardcard | Neobrutalism Components | Components | Free | no deps |
