1import { Badge } from "~/components/ui/badge";2
3export default function BadgeDemo() {4 return (5 <div class="flex flex-col items-center gap-2">6 <div class="flex w-full flex-wrap gap-2">7 <Badge>Badge</Badge>8 <Badge variant="neutral">Neutral Badge</Badge>9 </div>10 </div>11 );12}
npx shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/badge.json
yarn shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/badge.json
pnpm dlx shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/badge.json
bunx --bun shadcn@latest add https://solid-ui-neobrutalism.vercel.app/r/badge.json
Copy and paste the following code into your project
1import type { VariantProps } from "class-variance-authority";2import type { Component, ComponentProps } from "solid-js";3
4import { splitProps } from "solid-js";5import { cva } from "class-variance-authority";6
7import { cn } from "~/lib/utils";8
9const badgeVariants = cva(10 "inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-base border-2 border-border px-2.5 py-0.5 text-xs font-base whitespace-nowrap focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [&>svg]:pointer-events-none [&>svg]:size-3",11 {12 variants: {13 variant: {14 default: "bg-primary text-primary-foreground",15 neutral: "bg-secondary-background text-foreground",16 },17 },18 defaultVariants: {19 variant: "default",20 },21 },22);23
24type BadgeProps = ComponentProps<"div"> &25 VariantProps<typeof badgeVariants> & {26 round?: boolean;27 };28
29const Badge: Component<BadgeProps> = (props) => {30 const [local, others] = splitProps(props, ["class", "variant", "round"]);31 return (32 <div33 data-slot="badge"34 class={cn(35 badgeVariants({ variant: local.variant }),36 local.round && "rounded-full",37 local.class,38 )}39 {...others}40 />41 );42};43
44export type { BadgeProps };45export { Badge, badgeVariants };
Update the import paths to match your project setup.
1import { Badge } from "~/components/ui/badge";
1<Badge>Badge</Badge>