{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"components-alerts-dismissible-alerts","type":"registry:block","title":"Dismissible Alerts","files":[{"path":"components/blocks/components/alerts/dismissible-alerts.tsx","content":"import { useState } from 'react';\nimport { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';\nimport { Button } from '@/components/ui/button';\nimport {\n  AlertCircle,\n  AlertTriangle,\n  CheckCircle,\n  X,\n  XCircle,\n} from 'lucide-react';\n\nexport default function DismissibleAlerts() {\n  const [alerts, setAlerts] = useState({\n    default: true,\n    destructive: true,\n    success: true,\n    warning: true,\n    info: true,\n  });\n\n  const closeAlert = (type: keyof typeof alerts) => {\n    setAlerts((prev) => ({ ...prev, [type]: false }));\n  };\n\n  const resetAlerts = () => {\n    setAlerts({\n      default: true,\n      destructive: true,\n      success: true,\n      warning: true,\n      info: true,\n    });\n  };\n\n  return (\n    <div className=\"p-6\">\n      <div className=\"flex flex-col gap-4\">\n        {alerts.default && (\n          <Alert className=\"relative shadow-sm\">\n            <AlertTitle>Default Alert</AlertTitle>\n            <AlertDescription>\n              This is a dismissible default alert.\n            </AlertDescription>\n            <Button\n              variant=\"ghost\"\n              size=\"icon\"\n              className=\"absolute top-2 right-2 h-6 w-6\"\n              onClick={() => closeAlert('default')}\n            >\n              <X className=\"h-4 w-4\" />\n            </Button>\n          </Alert>\n        )}\n\n        {alerts.destructive && (\n          <Alert variant=\"destructive\" className=\"relative shadow-sm\">\n            <XCircle className=\"h-4 w-4\" />\n            <AlertTitle>Destructive Alert</AlertTitle>\n            <AlertDescription>\n              This is a dismissible destructive alert.\n            </AlertDescription>\n            <Button\n              variant=\"ghost\"\n              size=\"icon\"\n              className=\"text-destructive hover:bg-destructive/10 absolute top-2 right-2 h-6 w-6 !p-0\"\n              onClick={() => closeAlert('destructive')}\n            >\n              <X className=\"h-4 w-4\" />\n            </Button>\n          </Alert>\n        )}\n\n        {alerts.success && (\n          <Alert className=\"relative border-green-500/50 text-green-700 shadow-sm dark:border-green-500 dark:text-green-400 [&>svg]:text-green-500\">\n            <CheckCircle className=\"h-4 w-4\" />\n            <AlertTitle>Success Alert</AlertTitle>\n            <AlertDescription>\n              This is a dismissible success alert.\n            </AlertDescription>\n            <Button\n              variant=\"ghost\"\n              size=\"icon\"\n              className=\"absolute top-2 right-2 h-6 w-6 !p-0 text-green-700 hover:bg-green-500/10 dark:text-green-400\"\n              onClick={() => closeAlert('success')}\n            >\n              <X className=\"h-4 w-4\" />\n            </Button>\n          </Alert>\n        )}\n\n        {alerts.warning && (\n          <Alert className=\"relative border-yellow-500/50 text-yellow-700 shadow-sm dark:border-yellow-500 dark:text-yellow-400 [&>svg]:text-yellow-500\">\n            <AlertTriangle className=\"h-4 w-4\" />\n            <AlertTitle>Warning Alert</AlertTitle>\n            <AlertDescription>\n              This is a dismissible warning alert.\n            </AlertDescription>\n            <Button\n              variant=\"ghost\"\n              size=\"icon\"\n              className=\"absolute top-2 right-2 h-6 w-6 !p-0 text-yellow-700 hover:bg-yellow-500/10 dark:text-yellow-400\"\n              onClick={() => closeAlert('warning')}\n            >\n              <X className=\"h-4 w-4\" />\n            </Button>\n          </Alert>\n        )}\n\n        {alerts.info && (\n          <Alert className=\"relative border-blue-500/50 text-blue-700 shadow-sm dark:border-blue-500 dark:text-blue-400 [&>svg]:text-blue-500\">\n            <AlertCircle className=\"h-4 w-4\" />\n            <AlertTitle>Info Alert</AlertTitle>\n            <AlertDescription>\n              This is a dismissible info alert.\n            </AlertDescription>\n            <Button\n              variant=\"ghost\"\n              size=\"icon\"\n              className=\"absolute top-2 right-2 h-6 w-6 !p-0 text-blue-700 hover:bg-blue-500/10 dark:text-blue-400\"\n              onClick={() => closeAlert('info')}\n            >\n              <X className=\"h-4 w-4\" />\n            </Button>\n          </Alert>\n        )}\n      </div>\n\n      {!Object.values(alerts).every(Boolean) && (\n        <Button\n          className=\"mt-6 shadow-md transition-shadow hover:shadow-lg\"\n          onClick={resetAlerts}\n        >\n          Reset Alerts\n        </Button>\n      )}\n    </div>\n  );\n}\n","type":"registry:component","target":"components/blocks/components/alerts/dismissible-alerts.tsx"},{"path":"components/ui/alert.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n  \"group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-card text-card-foreground\",\n        destructive:\n          \"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nfunction Alert({\n  className,\n  variant,\n  ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof alertVariants>) {\n  return (\n    <div\n      data-slot=\"alert\"\n      role=\"alert\"\n      className={cn(alertVariants({ variant }), className)}\n      {...props}\n    />\n  )\n}\n\nfunction AlertTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-title\"\n      className={cn(\n        \"font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertDescription({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-description\"\n      className={cn(\n        \"text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AlertAction({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"alert-action\"\n      className={cn(\"absolute top-2.5 right-3\", className)}\n      {...props}\n    />\n  )\n}\n\nexport { Alert, AlertTitle, AlertDescription, AlertAction }\n","type":"registry:ui","target":"components/ui/alert.tsx"},{"path":"components/ui/button.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n  \"group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n        outline:\n          \"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n        destructive:\n          \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default:\n          \"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        xs: \"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n        sm: \"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5\",\n        lg: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        icon: \"size-9\",\n        \"icon-xs\":\n          \"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3\",\n        \"icon-sm\":\n          \"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md\",\n        \"icon-lg\": \"size-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction Button({\n  className,\n  variant = \"default\",\n  size = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"button\"> &\n  VariantProps<typeof buttonVariants> & {\n    asChild?: boolean\n  }) {\n  const Comp = asChild ? Slot.Root : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"button\"\n      data-variant={variant}\n      data-size={size}\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Button, buttonVariants }\n","type":"registry:ui","target":"components/ui/button.tsx"}],"description":"Alerts with a close button so users can clear a notice once read. Use for cookie banners, promotions, and warnings that should not stay forever.","dependencies":["class-variance-authority","lucide-react","radix-ui"]}