BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/sidcn/badge

Badge

sidcn/badge
FreeComponent

A beautiful badge component

Live preview

live · rendered by the registry
Rendered by sidcn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.siddhesh.cc/r/badge.json

Source

registry/new-york/components/badge.tsxui.siddhesh.cc/r/badge.json
1import { Slot } from "@radix-ui/react-slot";
2import { cva, type VariantProps } from "class-variance-authority";
3import type * as React from "react";
4
5import { cn } from "@/lib/utils";
6
7const badgeVariants = cva(
8 "inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium 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] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
9 {
10 variants: {
11 variant: {
12 default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
13 success:
14 "border-transparent bg-success text-white [a&]:hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40 dark:bg-success/60",
15 destructive:
16 "bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
17 warning:
18 "border-transparent bg-warning text-white [a&]:hover:bg-warning/90 focus-visible:ring-warning/20 dark:focus-visible:ring-warning/40 dark:bg-warning/60",
19 outline:
20 "border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
21 secondary:
22 "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
23 glass:
24 "border-border/40 bg-background/60 backdrop-blur-sm text-foreground [a&]:hover:bg-accent/50",
25 link: "text-primary underline-offset-4 [a&]:hover:underline",
26 ghost: "[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
27 },
28 size: {
29 default: "px-2 py-0.5 text-xs",
30 sm: "px-1.5 py-0.5 text-xs",
31 lg: "px-3 py-1 text-md",
32 },
33 },
34 defaultVariants: {
35 variant: "default",
36 size: "default",
37 },
38 },
39);
40
41function Badge({
42 className,
43 variant,
44 size,
45 asChild = false,
46 ...props
47}: React.ComponentProps<"span"> &
48 VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
49 const Comp = asChild ? Slot : "span";
50
51 return (
52 <Comp
53 data-slot="badge"
54 className={cn(badgeVariants({ variant, size }), className)}
55 {...props}
56 />
57 );
58}
59
60Badge.displayName = "Badge";
61
62export { Badge, badgeVariants };

What it pulls in

npm packages

  • @radix-ui/react-slot
  • class-variance-authority
  • https://ui.siddhesh.cc/r/utils.json

Files it writes

  • registry/new-york/components/badge.tsx

Facts

Registry
sidcn
Type
registry:ui
Access
Free
Files written
1
Theme wiring
ships cssVars
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on sidcn ui.siddhesh.cc Siddhesh-Agarwal/sid-cn on GitHub Raw registry item This item as JSON

More from sidcn

All 14 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
ButtonbuttonsidcnComponentsFree2 deps
Data Tabledata-tablesidcnComponentsFree2 deps
Date Inputdate-inputsidcnComponentsFree1 dep
Date Time Inputdate-time-inputsidcnComponentsFree2 deps
IconsiconssidcnComponentsFreeno deps
Package Manager Commandpackage-manager-commandsidcnComponentsFreeno deps
SidebarsidebarsidcnComponentsFree3 deps
SonnersonnersidcnComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex