Alert
glasswave/alertFreeComponent
Displays a callout for user attention.
Live preview
live · rendered by the registry
Rendered by glasswave on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://glasswave.denizisik.com/r/alert.jsonSource
1import { CircleAlert, CircleCheck, Info, TriangleAlert } from "lucide-react";2import type { ComponentType, ReactNode } from "react";3import { cn } from "@/lib/utils";4import { glass } from "@/lib/glass";56type AlertVariant = "default" | "destructive" | "success" | "warning";78const variantConfig: Record<9 AlertVariant,10 { icon: ComponentType<{ className?: string }>; accent: string }11> = {12 default: { icon: Info, accent: "text-[#007AFF]" },13 destructive: { icon: CircleAlert, accent: "text-[#FF3B30]" },14 success: { icon: CircleCheck, accent: "text-[#34C759]" },15 warning: { icon: TriangleAlert, accent: "text-[#FF9500]" },16};1718interface AlertProps {19 children: ReactNode;20 variant?: AlertVariant;21 className?: string;22 /** Custom leading icon. Pass `null` to hide the icon entirely. */23 icon?: ReactNode;24}2526export function Alert({27 children,28 variant = "default",29 className = "",30 icon,31}: AlertProps) {32 const { icon: DefaultIcon, accent } = variantConfig[variant];33 const showIcon = icon !== null;3435 return (36 <div37 role="alert"38 data-variant={variant}39 className={cn(glass, "flex items-start gap-3 p-4", className)}40 >41 {showIcon && (42 <span className={cn("mt-0.5 shrink-0 [&_svg]:size-5", accent)}>43 {icon ?? <DefaultIcon />}44 </span>45 )}46 <div className="flex min-w-0 flex-col gap-1">{children}</div>47 </div>48 );49}5051interface AlertTitleProps {52 children: ReactNode;53 className?: string;54}5556export function AlertTitle({ children, className = "" }: AlertTitleProps) {57 return (58 <div className={cn("font-semibold leading-6 tracking-tight", className)}>59 {children}60 </div>61 );62}6364interface AlertDescriptionProps {65 children: ReactNode;66 className?: string;67}6869export function AlertDescription({70 children,71 className = "",72}: AlertDescriptionProps) {73 return (74 <div className={cn("text-sm leading-relaxed text-current/70", className)}>75 {children}76 </div>77 );78}
What it pulls in
npm packages
Other registry items
Files it writes
More from glasswave
All 60 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | glasswave | Components | Free | 2 deps | |
| Alert Dialogalert-dialog | glasswave | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | glasswave | Components | Free | 1 dep | |
| Avataravatar | glasswave | Components | Free | 1 dep | |
| Badgebadge | glasswave | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | glasswave | Components | Free | 2 deps | |
| Buttonbutton | glasswave | Components | Free | 2 deps | |
| Button Groupbutton-group | glasswave | Components | Free | 1 dep |
