BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/adrianub/badge

badge

adrianub/badge
FreeComponent

adrianub publishes no description for this item.

Live preview

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

Install it

npx shadcn@latest add https://ui.adrianub.dev/r/styles/new-york/badge.json

Source

ui/badge.tsui.adrianub.dev/r/styles/new-york/badge.json
1import type { VariantProps } from 'class-variance-authority'
2import { computed, Directive, input } from '@angular/core'
3
4import { cva } from 'class-variance-authority'
5import { cn } from '~/lib/utils'
6
7export const badgeVariants = cva(
8 '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',
9 {
10 variants: {
11 variant: {
12 default:
13 'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
14 secondary:
15 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
16 destructive:
17 'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
18 outline: 'text-foreground',
19 },
20 },
21 defaultVariants: {
22 variant: 'default',
23 },
24 },
25)
26
27type BadgeProps = VariantProps<typeof badgeVariants>
28
29export type UbBadgeVariant = NonNullable<BadgeProps['variant']>
30
31@Directive({
32 selector: '[ubBadge]',
33 standalone: true,
34 host: {
35 '[class]': 'computedClass()',
36 },
37})
38export class UbBadgeDirective {
39 readonly class = input<string>()
40 readonly variant = input<UbBadgeVariant>('default')
41
42 protected computedClass = computed(() =>
43 cn(badgeVariants({ variant: this.variant(), class: this.class() })),
44 )
45}

Files it writes

  • ui/badge.ts

Facts

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

Go to the source

Docs on adrianub ui.adrianub.dev adrian-ub/shadcn-ng on GitHub Raw registry item This item as JSON

More from adrianub

All 23 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionadrianubComponentsFree1 dep
alertalertadrianubComponentsFreeno deps
aspect-ratioaspect-ratioadrianubComponentsFree1 dep
avataravataradrianubComponentsFree1 dep
breadcrumbbreadcrumbadrianubComponentsFreeno deps
buttonbuttonadrianubComponentsFreeno deps
cardcardadrianubComponentsFreeno deps
collapsiblecollapsibleadrianubComponentsFree1 dep
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