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 DocumentationAtlas SearchAPI 3 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  516cf6c8_73a0_53be_028d_8a3da88bbaec["alert.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  516cf6c8_73a0_53be_028d_8a3da88bbaec --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  191e4a89_25e4_f7a3_d5fb_d71d101e0990["utils"]
  516cf6c8_73a0_53be_028d_8a3da88bbaec --> 191e4a89_25e4_f7a3_d5fb_d71d101e0990
  25383e8d_ca91_a50e_c3a8_5f228d02e1df["class-variance-authority"]
  516cf6c8_73a0_53be_028d_8a3da88bbaec --> 25383e8d_ca91_a50e_c3a8_5f228d02e1df
  style 516cf6c8_73a0_53be_028d_8a3da88bbaec 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"

const alertVariants = cva(
  "grid gap-0.5 rounded-lg border px-2.5 py-2 text-start text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pe-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4 w-full relative group/alert",
  {
    variants: {
      variant: {
        default: "bg-card text-card-foreground",
        destructive:
          "text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
      },
    },
    defaultVariants: {
      variant: "default",
    },
  }
)

function Alert({
  className,
  variant,
  ...props
}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
  return (
    <div
      data-slot="alert"
      role="alert"
      className={cn(alertVariants({ variant }), className)}
      {...props}
    />
  )
}

function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="alert-title"
      className={cn(
        "[&_a]:hover:text-foreground font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3",
        className
      )}
      {...props}
    />
  )
}

function AlertDescription({
  className,
  ...props
}: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="alert-description"
      className={cn(
        "text-muted-foreground [&_a]:hover:text-foreground text-sm text-balance md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_p:not(:last-child)]:mb-4",
        className
      )}
      {...props}
    />
  )
}

function AlertAction({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="alert-action"
      className={cn("absolute end-2 top-2", className)}
      {...props}
    />
  )
}

export { Alert, AlertTitle, AlertDescription, AlertAction }

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 DocumentationAtlas domain, SearchAPI subdomain.
What functions are defined in alert.tsx?
alert.tsx defines 4 function(s): Alert, AlertAction, 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 apps/v4/examples/radix/ui-rtl/alert.tsx (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/examples/radix/ui-rtl).

Analyze Your Own Codebase

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

Try Supermodel Free