shadimage
pane
uibadgesource: ok · hit

Badge

A compact glass badge in default and tinted variants, with asChild support for linking.

npx shadcn add "https://pane.theui.company/r/badge.json"
free

Visual style

glass-blur

Tags auto-generated by rules on 9/24/2026 — empty means no evidence, not lack of support.

Dependencies

Bundle weight · light
class-variance-authorityradix-ui

Registry dependencies

@pane/pane@pane/utils

Files1 · source cached 10/14/2026, 1:26:59 PM

registry/pane/ui/badge.tsx
import { cva, type VariantProps } from "class-variance-authority";
import { Slot } from "radix-ui";
import type * as React from "react";
import { Pane } from "@/components/ui/pane";
import { cn } from "@/lib/utils";

const badgeVariants = cva(
  "inline-flex w-fit shrink-0 items-center justify-center gap-1 whitespace-nowrap px-2.5 py-0.5 text-xs font-medium [&_svg]:size-3 [&_svg]:pointer-events-none",
  {
    variants: {
      variant: {
        default: "text-foreground",
      },
    },
    defaultVariants: { variant: "default" },
  },
);

export interface BadgeProps
  extends React.ComponentProps<"span">,
    VariantProps<typeof badgeVariants> {
  asChild?: boolean;
}

function Badge({
  className,
  variant = "default",
  asChild = false,
  ...props
}: BadgeProps) {
  const Comp = asChild ? Slot.Root : "span";
  return (
    <Pane variant="clear" radius={999} className="inline-flex w-fit shrink-0">
      <Comp
        data-slot="badge"
        className={cn(badgeVariants({ variant, className }), "bg-transparent")}
        {...props}
      />
    </Pane>
  );
}

export { Badge, badgeVariants };

More from pane

Browse all components in this library →