BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/solid-ui/badge

Badge

solid-ui/badge
FreeComponent

A badge component

Live preview

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

Install it

npx shadcn@latest add https://www.solid-ui.com/r/badge.json

Source

src/registry/ui/badge.tsxwww.solid-ui.com/r/badge.json
1import type { Component, ComponentProps } from "solid-js"
2import { splitProps } from "solid-js"
3
4import type { VariantProps } from "class-variance-authority"
5import { cva } from "class-variance-authority"
6
7import { cn } from "~/lib/utils"
8
9const badgeVariants = cva(
10 "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
11 {
12 variants: {
13 variant: {
14 default: "border-transparent bg-primary text-primary-foreground",
15 secondary: "border-transparent bg-secondary text-secondary-foreground",
16 outline: "text-foreground",
17 success: "border-success-foreground bg-success text-success-foreground",
18 warning: "border-warning-foreground bg-warning text-warning-foreground",
19 error: "border-error-foreground bg-error text-error-foreground"
20 }
21 },
22 defaultVariants: {
23 variant: "default"
24 }
25 }
26)
27
28type BadgeProps = ComponentProps<"div"> &
29 VariantProps<typeof badgeVariants> & {
30 round?: boolean
31 }
32
33const Badge: Component<BadgeProps> = (props) => {
34 const [local, others] = splitProps(props, ["class", "variant", "round"])
35 return (
36 <div
37 class={cn(
38 badgeVariants({ variant: local.variant }),
39 local.round && "rounded-full",
40 local.class
41 )}
42 {...others}
43 />
44 )
45}
46
47export type { BadgeProps }
48export { Badge, badgeVariants }

What it pulls in

npm packages

  • solid-js
  • class-variance-authority

Files it writes

  • src/registry/ui/badge.tsx

Facts

Registry
solid-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on solid-ui www.solid-ui.com stefan-karger/solid-ui on GitHub Raw registry item This item as JSON

More from solid-ui

All 55 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionsolid-uiComponentsFree2 deps
Alertalertsolid-uiComponentsFree3 deps
Alert Dialogalert-dialogsolid-uiComponentsFree2 deps
Aspect Ratioaspect-ratiosolid-uiComponentsFree1 dep
Avataravatarsolid-uiComponentsFree2 deps
Badge Deltabadge-deltasolid-uiComponentsFree2 deps
Bar Listbar-listsolid-uiComponentsFree1 dep
Breadcrumbbreadcrumbsolid-uiComponentsFree2 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