BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/uiable/badge

Badge

uiable/badge
FreeComponent

Badge component.

Live preview

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

Install it

npx shadcn@latest add https://uiable.com/r/badge.json

Source

src/components/ui/badge.tsxuiable.com/r/badge.json
1"use client";
2
3import { mergeProps } from "@base-ui/react/merge-props";
4import { useRender } from "@base-ui/react/use-render";
5import { cva, type VariantProps } from "class-variance-authority";
6
7import { cn } from "@/lib/utils";
8
9const badgeVariants = cva(
10 "gap-1 rounded-lg border border-transparent px-[0.8em] py-[0.45em] text-[.75em] font-medium leading-[0.9] transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>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 overflow-hidden group/badge",
11 {
12 variants: {
13 variant: {
14 default: "bg-primary text-white [a]:hover:bg-primary/80",
15 secondary:
16 "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
17 destructive:
18 "bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",
19 outline:
20 "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
21 ghost:
22 "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
23 link: "text-primary underline-offset-4 hover:underline"
24 }
25 },
26 defaultVariants: {
27 variant: "default"
28 }
29 }
30);
31
32function Badge({
33 className,
34 variant = "default",
35 render,
36 ...props
37}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
38 return useRender({
39 defaultTagName: "span",
40 props: mergeProps<"span">(
41 {
42 className: cn(badgeVariants({ variant }), className)
43 },
44 props
45 ),
46 render,
47 state: {
48 slot: "badge",
49 variant
50 }
51 });
52}
53
54export { Badge, badgeVariants };

What it pulls in

npm packages

  • @base-ui/react
  • class-variance-authority

Files it writes

  • src/components/ui/badge.tsx

Facts

Registry
uiable
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-03
Last confirmed
yesterday

Go to the source

Docs on uiable uiable.com codedthemes/uiable on GitHub Raw registry item This item as JSON

More from uiable

All 712 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionuiableComponentsFree2 deps
AlertalertuiableComponentsFree1 dep
Alert Dialogalert-dialoguiableComponentsFree1 dep
Aspect Ratioaspect-ratiouiableComponentsFreeno deps
AttachmentattachmentuiableComponentsFree2 deps
AvataravataruiableComponentsFree1 dep
BreadcrumbbreadcrumbuiableComponentsFree2 deps
BubblebubbleuiableComponentsFree2 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