Alert

Consent Alert

A cookie consent request where refusal carries the same weight as agreement. Not politeness: the Reject button cannot be greyer and smaller than Accept.

  • alert
  • cookie
  • consent
  • privacy

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/alert-013?lang=en

Cookies and analyticsОбязательные cookie нужны для входа и работы сайта. Аналитические помогают понять, какими разделами пользуются, — их можно отключить. Политика конфиденциальности
Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

# Install and place "alert-013" (Consent Alert) from VibeUI

## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/alert-013.json

Registry item: https://vibeui.ru/r/alert-013.json
Installs to: components/vibeui/alert-013.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.

Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.

## 2. What it is
A cookie consent request where refusal carries the same weight as agreement. Not politeness: the Reject button cannot be greyer and smaller than Accept.

A cookie consent request: an explanation with a link to the policy, "Essential only" and "Accept all" at equal weight, and a quiet Settings link. It folds into a column when narrow. Zero dependencies, one file, its own palette.

## 3. How to use it
import { Alert013 } from "@/components/vibeui/alert-013"

<Alert013
  onAccept={acceptAll}
  onReject={rejectOptional}
  onSettings={openSettings}
/>

Read the installed file for the full prop list.

## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.

Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)

## 5. Keep exactly as installed
- the equal weight of accept and reject: a size or colour difference here is a dark pattern and, in many jurisdictions, a violation
- the local --vibeui-alert-013-* palette — do not swap it for your theme tokens
- the policy link inside the explanation rather than as a separate button
- Settings as the third, quiet action: the two-way choice must stay obvious
- the @container query: stacked, the buttons share the width equally rather than one filling it
- the <style> block inside the component — it holds the palette and the layout

## 6. You may change
- the title and description copy
- policyLabel and policyHref — the policy link
- the acceptLabel, rejectLabel and settingsLabel wording
- the onAccept, onReject and onSettings handlers
- the accent through the accent prop — it colours the accept button and the link

## 7. Rules
- The component stores no choice and sets no cookies — the caller does that, and decides whether to show the block at all.
- Analytics must not run before consent. Showing the banner while loading trackers defeats it.
- Do not hide refusal inside Settings: rejecting has to take one click, like accepting.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.

## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.

For developers

npx shadcn@latest add https://vibeui.ru/r/alert-013.json
https://vibeui.ru/r/alert-013.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-alert-013-*. Кнопки согласия и отказа одного размера и одной высоты: разный вес здесь — тёмный приём, а не оформление. Настройка вынесена третьей тихой ссылкой, чтобы выбор из двух вариантов оставался очевидным. В узкой колонке блок складывается в столбик, кнопки растягиваются поровну через @container.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Alert013Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "title" | "children"
> & {
  title?: string
  description?: string
  policyLabel?: string
  policyHref?: string
  acceptLabel?: string
  rejectLabel?: string
  settingsLabel?: string
  onAccept?: () => void
  onReject?: () => void
  onSettings?: () => void
  accent?: string
}

// Идея компонента: запрос согласия на cookie. Отказ равен согласию по весу —
// это не вежливость, а требование закона: кнопка «Отклонить» не может быть
// серее и мельче «Принять». Настройка вынесена третьей ссылкой, чтобы выбор
// из двух вариантов оставался очевидным.
const STYLES = `
:where([data-vibeui-block="alert-013"]){
--vibeui-alert-013-fg:oklch(0.22 0.014 265);
--vibeui-alert-013-muted:oklch(0.5 0.014 265);
--vibeui-alert-013-bg:oklch(1 0 0);
--vibeui-alert-013-border:oklch(0.89 0.006 265);
--vibeui-alert-013-accent:oklch(0.55 0.2 262);
--vibeui-alert-013-radius:1rem;
--vibeui-alert-013-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
[data-vibeui-block="alert-013"]{
/* flex-wrap живёт здесь, а не в @container: контейнерный запрос применяется
   к потомкам контейнера, но не к нему самому. На широкой раскладке перенос
   ни на что не влияет — всё умещается в строку. */
display:flex;flex-wrap:wrap;align-items:center;gap:0.875rem 1.25rem;
width:100%;max-width:44rem;box-sizing:border-box;
padding:1rem 1.125rem;
border:1px solid var(--vibeui-alert-013-border);
border-radius:var(--vibeui-alert-013-radius);
background:var(--vibeui-alert-013-bg);color:var(--vibeui-alert-013-fg);
font-family:var(--vibeui-alert-013-font);
box-shadow:0 18px 40px -28px oklch(0.2 0.03 265 / 45%);
}
[data-vibeui-block="alert-013"] [data-part="text"]{display:flex;flex-direction:column;gap:0.1875rem;flex:1 1 auto;min-width:0}
[data-vibeui-block="alert-013"] [data-part="title"]{font-size:0.875rem;font-weight:600;line-height:1.4}
[data-vibeui-block="alert-013"] [data-part="description"]{font-size:0.8125rem;line-height:1.55;color:var(--vibeui-alert-013-muted);max-width:60ch}
[data-vibeui-block="alert-013"] [data-part="policy"]{color:var(--vibeui-alert-013-accent);text-decoration:underline}
[data-vibeui-block="alert-013"] [data-part="actions"]{display:flex;align-items:center;gap:0.5rem;flex:none}
/* Отказ и согласие одного веса: разный размер кнопок здесь — тёмный приём. */
[data-vibeui-block="alert-013"] [data-part="accept"],
[data-vibeui-block="alert-013"] [data-part="reject"]{
appearance:none;cursor:pointer;font:inherit;
display:inline-flex;align-items:center;height:2.125rem;padding:0 1rem;
border-radius:0.5rem;border:1px solid transparent;
font-size:0.8125rem;font-weight:600;
transition:background-color .16s ease,border-color .16s ease;
}
[data-vibeui-block="alert-013"] [data-part="accept"]{
background:var(--vibeui-alert-013-accent);color:oklch(1 0 0);
}
[data-vibeui-block="alert-013"] [data-part="accept"]:hover{filter:brightness(0.94)}
[data-vibeui-block="alert-013"] [data-part="reject"]{
background:transparent;color:var(--vibeui-alert-013-fg);
border-color:var(--vibeui-alert-013-border);
}
[data-vibeui-block="alert-013"] [data-part="reject"]:hover{background:color-mix(in oklab,var(--vibeui-alert-013-border) 40%,transparent)}
[data-vibeui-block="alert-013"] [data-part="settings"]{
appearance:none;border:0;background:none;cursor:pointer;padding:0;
color:var(--vibeui-alert-013-muted);font:inherit;font-size:0.8125rem;text-decoration:underline;
}
[data-vibeui-block="alert-013"] [data-part="settings"]:hover{color:var(--vibeui-alert-013-fg)}
[data-vibeui-block="alert-013"] a:focus-visible,
[data-vibeui-block="alert-013"] button:focus-visible{outline:2px solid var(--vibeui-alert-013-accent);outline-offset:2px;border-radius:0.375rem}
@container (max-width: 34rem){
[data-vibeui-block="alert-013"] [data-part="text"]{flex:1 1 100%}
[data-vibeui-block="alert-013"] [data-part="actions"]{flex:1 1 100%;flex-wrap:wrap}
[data-vibeui-block="alert-013"] [data-part="accept"],
[data-vibeui-block="alert-013"] [data-part="reject"]{flex:1 1 0;justify-content:center}
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="alert-013"] *{animation:none!important;transition:none!important}}
`

/**
 * Запрос согласия на cookie: отказ равен согласию по весу.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Alert013({
  title = "Cookie и аналитика",
  description = "Обязательные cookie нужны для входа и работы сайта. Аналитические помогают понять, какими разделами пользуются, — их можно отключить.",
  policyLabel = "Политика конфиденциальности",
  policyHref = "#privacy",
  acceptLabel = "Принять всё",
  rejectLabel = "Только обязательные",
  settingsLabel = "Настроить",
  onAccept,
  onReject,
  onSettings,
  accent,
  className,
  style,
  ...props
}: Alert013Props) {
  const palette = {
    ...(accent ? { "--vibeui-alert-013-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-alert-013" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="alert-013"
        role="region"
        aria-label={title}
        className={className}
        style={palette}
      >
        <span data-part="text">
          <span data-part="title">{title}</span>
          <span data-part="description">
            {description}{" "}
            {policyLabel ? (
              <a data-part="policy" href={policyHref}>
                {policyLabel}
              </a>
            ) : null}
          </span>
        </span>
        <span data-part="actions">
          <button data-part="reject" type="button" onClick={onReject}>
            {rejectLabel}
          </button>
          <button data-part="accept" type="button" onClick={onAccept}>
            {acceptLabel}
          </button>
          {settingsLabel ? (
            <button data-part="settings" type="button" onClick={onSettings}>
              {settingsLabel}
            </button>
          ) : null}
        </span>
      </div>
    </>
  )
}