badge
neobrutalism/badgeFreeComponent
neobrutalism publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by neobrutalism on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://neobrutalism.com/r/badge.jsonSource
1import { mergeProps } from "@base-ui/react/merge-props"2import { useRender } from "@base-ui/react/use-render"3import { cva, type VariantProps } from "class-variance-authority"45import { cn } from "@/lib/utils"67const badgeVariants = cva(8 "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded border-2 px-2 py-0.5 text-xs font-head font-medium whitespace-nowrap shadow-sm transition-all focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive [&>svg]:pointer-events-none [&>svg]:size-3!",9 {10 variants: {11 variant: {12 default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",13 secondary:14 "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",15 destructive:16 "bg-destructive text-destructive-foreground [a]:hover:bg-destructive/90",17 outline:18 "bg-transparent text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",19 ghost:20 "border-transparent bg-transparent shadow-none hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",21 link: "border-transparent bg-transparent shadow-none text-primary underline-offset-4 hover:underline",22 },23 },24 defaultVariants: {25 variant: "default",26 },27 }28)2930function Badge({31 className,32 variant = "default",33 render,34 ...props35}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {36 return useRender({37 defaultTagName: "span",38 props: mergeProps<"span">(39 {40 className: cn(badgeVariants({ variant }), className),41 },42 props43 ),44 render,45 state: {46 slot: "badge",47 variant,48 },49 })50}5152export { Badge, badgeVariants }
What it pulls in
npm packages
Files it writes
More from neobrutalism
All 54 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | neobrutalism | Components | Free | 2 deps | |
| alertalert | neobrutalism | Components | Free | 2 deps | |
| alert-dialogalert-dialog | neobrutalism | Components | Free | 1 dep | |
| aspect-ratioaspect-ratio | neobrutalism | Components | Free | 1 dep | |
| avataravatar | neobrutalism | Components | Free | 1 dep | |
| breadcrumbbreadcrumb | neobrutalism | Components | Free | 2 deps | |
| buttonbutton | neobrutalism | Components | Free | 2 deps | |
| button-groupbutton-group | neobrutalism | Components | Free | 2 deps |
