neobrutalism
components
ui

badge

Displays a small badge or label with neobrutalism design style.

badge
brutalist
label
tag
indicator
View Docs

Source Code

Files
badge.tsx
1import { type VariantProps, cva } from "class-variance-authority";
2import type * as React from "react";
3
4// Utility function for class name merging
5const cn = (...classes: any[]) => classes.filter(Boolean).join(" ");
6
7const badgeVariants = cva(
8  "inline-flex items-center rounded-base border-2 border-border px-2.5 font-base py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-black focus:ring-offset-2",
9  {
10    variants: {
11      variant: {
12        default: "bg-main text-mtext",
13        neutral: "bg-bw text-text",
14      },
15    },
16    defaultVariants: {
17      variant: "default",
18    },
19  }
20);
21
22export interface BadgeProps
23  extends React.HTMLAttributes<HTMLDivElement>,
24    VariantProps<typeof badgeVariants> {}
25
26function Badge({ className, variant, ...props }: BadgeProps) {
27  return (
28    <div className={cn(badgeVariants({ variant }), className)} {...props} />
29  );
30}
31
32export { Badge, badgeVariants };
33