Home / File/ alert.tsx — ui Source File

alert.tsx — ui Source File

Architecture documentation for alert.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.

File tsx ComponentRegistry ChartRegistry 3 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  9428acdb_a547_3265_56b8_e2e98443697e["alert.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  9428acdb_a547_3265_56b8_e2e98443697e --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  9428acdb_a547_3265_56b8_e2e98443697e --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  9428acdb_a547_3265_56b8_e2e98443697e --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  style 9428acdb_a547_3265_56b8_e2e98443697e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"

import { cn } from "@/lib/utils"

const alertVariants = cva(
  "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
  {
    variants: {
      variant: {
        default: "bg-background text-foreground",
        destructive:
          "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
      },
    },
    defaultVariants: {
      variant: "default",
    },
  }
)

const Alert = React.forwardRef<
  HTMLDivElement,
  React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
>(({ className, variant, ...props }, ref) => (
  <div
    ref={ref}
    role="alert"
    className={cn(alertVariants({ variant }), className)}
    {...props}
  />
))
Alert.displayName = "Alert"

const AlertTitle = React.forwardRef<
  HTMLParagraphElement,
  React.HTMLAttributes<HTMLHeadingElement>
>(({ className, ...props }, ref) => (
  <h5
    ref={ref}
    className={cn("mb-1 font-medium leading-none tracking-tight", className)}
    {...props}
  />
))
AlertTitle.displayName = "AlertTitle"

const AlertDescription = React.forwardRef<
  HTMLParagraphElement,
  React.HTMLAttributes<HTMLParagraphElement>
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("text-sm [&_p]:leading-relaxed", className)}
    {...props}
  />
))
AlertDescription.displayName = "AlertDescription"

export { Alert, AlertTitle, AlertDescription }

Subdomains

Dependencies

  • class-variance-authority
  • react
  • utils

Frequently Asked Questions

What does alert.tsx do?
alert.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in alert.tsx?
alert.tsx defines 3 function(s): Alert, AlertDescription, AlertTitle.
What does alert.tsx depend on?
alert.tsx imports 3 module(s): class-variance-authority, react, utils.
Where is alert.tsx in the architecture?
alert.tsx is located at deprecated/www/registry/default/ui/alert.tsx (domain: ComponentRegistry, subdomain: ChartRegistry, directory: deprecated/www/registry/default/ui).

Analyze Your Own Codebase

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

Try Supermodel Free