# V alert 12

> Cookie consent banner with accept and decline

A shadcn/ui block from the [@cnippet](https://ui.cnippet.dev/) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet/v-alert-12).

- Page, with a live preview: https://shadcn.exchange/r/cnippet/v-alert-12
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/cnippet/v-alert-12-light-91ad2c43d182a131.png
- Registry item: https://ui.cnippet.dev/r/v-alert-12.json
- Categories: alert
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://ui.cnippet.dev/r/v-alert-12.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- Registry items: `@cnippet/alert`

## Files

### `registry/default/variants/v-alert-12.tsx`

```tsx
"use client";

import { CookieIcon } from "lucide-react";
import { useState } from "react";
import {
  Alert,
  AlertAction,
  AlertDescription,
  AlertTitle,
} from "@/registry/default/ui/alert";
import { Button } from "@/registry/default/ui/button";

export function Pattern() {
  const [dismissed, setDismissed] = useState(false);

  if (dismissed) return null;

  return (
    <div className="w-full max-w-lg">
      <Alert className="shadow-md">
        <CookieIcon />
        <AlertTitle>We use cookies</AlertTitle>
        <AlertDescription className="inline-auto">
          We use cookies to personalize content, analyze traffic, and improve
          your experience. By continuing, you agree to our{" "}
          <a
            className="underline underline-offset-2 hover:text-foreground"
            href="#"
          >
            cookie policy
          </a>
          .
        </AlertDescription>
        <AlertAction className="mt-1">
          <Button
            onClick={() => setDismissed(true)}
            size="xs"
            variant="outline"
          >
            Decline
          </Button>
          <Button onClick={() => setDismissed(true)} size="xs">
            Accept All
          </Button>
        </AlertAction>
      </Alert>
    </div>
  );
}
```
