BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn/ui/badge

badge

draco-china-github/badge
FreeComponent

shadcn/ui publishes no description for this item.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/draco-china/shadcn-pro/main/apps/docs/public/r/styles/radix-sera/badge.json

Source

registry/radix-sera/ui/badge.tsxraw.githubusercontent.com/draco-china/shadcn-pro/main/apps/docs/public/r/styles/radix-sera/badge.json
1import * as React from "react"
2import { cva, type VariantProps } from "class-variance-authority"
3import { Slot } from "radix-ui"
4
5import { cn } from "@/registry/radix-sera/lib/utils"
6
7const badgeVariants = cva(
8 "group/badge inline-flex w-fit shrink-0 items-center justify-center gap-1.5 overflow-hidden rounded-none border-0 bg-transparent px-0 py-0 text-[0.625rem] font-semibold tracking-widest whitespace-nowrap uppercase transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-0 has-data-[icon=inline-start]:pl-0 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
9 {
10 variants: {
11 variant: {
12 default: "text-foreground [a]:hover:text-foreground/70",
13 secondary: "text-muted-foreground [a]:hover:text-foreground",
14 destructive:
15 "text-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:text-destructive/70",
16 outline: "text-foreground [a]:hover:text-foreground/70",
17 ghost: "text-muted-foreground hover:text-foreground",
18 link: "text-foreground underline-offset-4 hover:underline",
19 },
20 },
21 defaultVariants: {
22 variant: "default",
23 },
24 }
25)
26
27function Badge({
28 className,
29 variant = "default",
30 asChild = false,
31 ...props
32}: React.ComponentProps<"span"> &
33 VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
34 const Comp = asChild ? Slot.Root : "span"
35
36 return (
37 <Comp
38 data-slot="badge"
39 data-variant={variant}
40 className={cn(badgeVariants({ variant }), className)}
41 {...props}
42 />
43 )
44}
45
46export { Badge, badgeVariants }

Files it writes

  • registry/radix-sera/ui/badge.tsx

Facts

Registry
shadcn/ui
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
today

Go to the source

draco-china.github.io draco-china/shadcn-pro on GitHub Raw registry item This item as JSON

More from shadcn/ui

All 201 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionshadcn/uiComponentsFreeno deps
alertalertshadcn/uiComponentsFreeno deps
alert-dialogalert-dialogshadcn/uiComponentsFreeno deps
aspect-ratioaspect-ratioshadcn/uiComponentsFreeno deps
avataravatarshadcn/uiComponentsFreeno deps
breadcrumbbreadcrumbshadcn/uiComponentsFreeno deps
buttonbuttonshadcn/uiComponentsFreeno deps
button-groupbutton-groupshadcn/uiComponentsFreeno 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