Alert Glass
shadcn-glass-ui/alert-glassFreeComponent
Glass-themed alert with:
Install it
npx shadcn@latest add https://raw.githubusercontent.com/artyhoo/shadcn-glass-ui-library/main/public/r/alert-glass.jsonSource
1/**2 * AlertGlass Component3 *4 * Glass-themed alert with:5 * - Theme-aware styling via CSS variables (glass/light/aurora)6 * - shadcn/ui compatible variants (default, destructive)7 * - Extended Glass UI variants (success, warning)8 * - Compound component API for flexible composition9 * - Dismissible option10 * - Backdrop blur effect11 *12 * @example Compound API (recommended)13 * ```tsx14 * <AlertGlass variant="default">15 * <AlertGlassTitle>Heads up!</AlertGlassTitle>16 * <AlertGlassDescription>17 * You can add components to your app using the cli.18 * </AlertGlassDescription>19 * </AlertGlass>20 * ```21 *22 * @example With dismiss button23 * ```tsx24 * <AlertGlass variant="destructive" dismissible onDismiss={() => setShow(false)}>25 * <AlertGlassTitle>Error</AlertGlassTitle>26 * <AlertGlassDescription>27 * Your session has expired.28 * </AlertGlassDescription>29 * </AlertGlass>30 * ```31 */3233'use client';3435import { forwardRef, type CSSProperties } from 'react';36import { type VariantProps } from 'class-variance-authority';37import { Info, CheckCircle, AlertTriangle, AlertCircle, X } from 'lucide-react';38import { cn } from '@/lib/utils';39import { alertVariants } from '@/lib/variants/alert-glass-variants';40import { ICON_SIZES } from '@/components/glass/primitives';41import '@/glass-theme.css';4243import type { AlertVariant } from '@/lib/variants/alert-glass-variants';4445// ========================================46// ICON MAP47// ========================================4849const iconMap: Record<AlertVariant, typeof Info> = {50 default: Info,51 destructive: AlertCircle,52 success: CheckCircle,53 warning: AlertTriangle,54 // Aliases55 info: Info,56 error: AlertCircle,57};5859// ========================================60// CSS VARIABLE HELPERS61// ========================================6263type AlertStyleVars = { bg: string; border: string; text: string };6465const variantStyles: Record<AlertVariant, AlertStyleVars> = {66 // shadcn/ui compatible variants67 default: {68 bg: 'var(--alert-default-bg)',69 border: 'var(--alert-default-border)',70 text: 'var(--alert-default-text)',71 },72 destructive: {73 bg: 'var(--alert-destructive-bg)',74 border: 'var(--alert-destructive-border)',75 text: 'var(--alert-destructive-text)',76 },77 // Glass UI extended variants78 success: {79 bg: 'var(--alert-success-bg)',80 border: 'var(--alert-success-border)',81 text: 'var(--alert-success-text)',82 },83 warning: {84 bg: 'var(--alert-warning-bg)',85// … truncated
More from shadcn-glass-ui
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Background Glassanimated-background-glass | shadcn-glass-ui | Components | Free | no deps | |
| Avatar Glassavatar-glass | shadcn-glass-ui | Components | Free | no deps | |
| Badge Glassbadge-glass | shadcn-glass-ui | Components | Free | no deps | |
| Base Progress Glassbase-progress-glass | shadcn-glass-ui | Components | Free | no deps | |
| Button Glassbutton-glass | shadcn-glass-ui | Components | Free | no deps | |
| Card Glasscard-glass | shadcn-glass-ui | Components | Free | no deps | |
| Checkbox Glasscheckbox-glass | shadcn-glass-ui | Components | Free | no deps | |
| Circular Progress Glasscircular-progress-glass | shadcn-glass-ui | Components | Free | no deps |
