Home / File/ badge.tsx — ui Source File

badge.tsx — ui Source File

Architecture documentation for badge.tsx, a tsx file in the ui codebase. 4 imports, 0 dependents.

File tsx DocumentationAtlas SearchAPI 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  f785b46c_32bd_f482_3612_c25b1be9260e["badge.tsx"]
  3d9438e8_7604_787c_4898_907262aff28b["utils"]
  f785b46c_32bd_f482_3612_c25b1be9260e --> 3d9438e8_7604_787c_4898_907262aff28b
  9c25e96d_58e7_da5f_38f2_06bde0124112["merge-props"]
  f785b46c_32bd_f482_3612_c25b1be9260e --> 9c25e96d_58e7_da5f_38f2_06bde0124112
  54befa66_d51c_07e2_ec3f_848afbcd88a7["use-render"]
  f785b46c_32bd_f482_3612_c25b1be9260e --> 54befa66_d51c_07e2_ec3f_848afbcd88a7
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  f785b46c_32bd_f482_3612_c25b1be9260e --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  style f785b46c_32bd_f482_3612_c25b1be9260e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { cn } from "@/examples/base/lib/utils"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"

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",
  render,
  ...props
}: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>) {
  return useRender({
    defaultTagName: "span",
    props: mergeProps<"span">(
      {
        className: cn(badgeVariants({ className, variant })),
      },
      props
    ),
    render,
    state: {
      slot: "badge",
      variant,
    },
  })
}

export { Badge, badgeVariants }

Subdomains

Functions

Dependencies

  • class-variance-authority
  • merge-props
  • use-render
  • utils

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, merge-props, use-render, utils.
Where is badge.tsx in the architecture?
badge.tsx is located at apps/v4/examples/base/ui/badge.tsx (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/examples/base/ui).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free