badge.tsx — ui Source File
Architecture documentation for badge.tsx, a tsx file in the ui codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 8b9b12bf_6b2c_0c02_76eb_1e9e1404c97e["badge.tsx"] 1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"] 8b9b12bf_6b2c_0c02_76eb_1e9e1404c97e --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2 191e4a89_25e4_f7a3_d5fb_d71d101e0990["utils"] 8b9b12bf_6b2c_0c02_76eb_1e9e1404c97e --> 191e4a89_25e4_f7a3_d5fb_d71d101e0990 25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"] 8b9b12bf_6b2c_0c02_76eb_1e9e1404c97e --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df 9c463da6_747b_38dc_586b_cbb4873070b1["radix-ui"] 8b9b12bf_6b2c_0c02_76eb_1e9e1404c97e --> 9c463da6_747b_38dc_586b_cbb4873070b1 style 8b9b12bf_6b2c_0c02_76eb_1e9e1404c97e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import * as React from "react"
import { cn } from "@/examples/radix/lib/utils"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"
const badgeVariants = cva(
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium 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",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
secondary:
"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
destructive:
"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",
outline:
"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
ghost:
"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
link: "text-primary underline-offset-4 hover:underline",
},
},
defaultVariants: {
variant: "default",
},
}
)
function Badge({
className,
variant = "default",
asChild = false,
...props
}: React.ComponentProps<"span"> &
VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
const Comp = asChild ? Slot.Root : "span"
return (
<Comp
data-slot="badge"
data-variant={variant}
className={cn(badgeVariants({ variant }), className)}
{...props}
/>
)
}
export { Badge, badgeVariants }
Domain
Subdomains
Functions
Dependencies
- class-variance-authority
- radix-ui
- react
- utils
Source
Frequently Asked Questions
What does badge.tsx do?
badge.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, SearchAPI subdomain.
What functions are defined in badge.tsx?
badge.tsx defines 1 function(s): Badge.
What does badge.tsx depend on?
badge.tsx imports 4 module(s): class-variance-authority, radix-ui, react, utils.
Where is badge.tsx in the architecture?
badge.tsx is located at apps/v4/examples/radix/ui/badge.tsx (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/examples/radix/ui).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free