Alert

Solid Alert

A tone-filled alert — the heaviest weight in the set. For the one case a message must not be missed: a failed payment, a service down, data about to be deleted.

  • alert
  • solid
  • critical
  • notification

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-002?lang=en

Payment failedThe bank declined the charge. The project stays published for 5 more days, then goes read-only.Update card
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-002" (Solid 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-002.json

Registry item: https://vibeui.ru/r/alert-002.json
Installs to: components/vibeui/alert-002.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 tone-filled alert — the heaviest weight in the set. For the one case a message must not be missed: a failed payment, a service down, data about to be deleted.

An alert flooded with its tone: an outlined glyph, a title, a description in a muted shade of the same tone, and an action on the right. The heaviest weight in the set, for messages that cannot be missed. Four tones, with the action wrapping in a narrow column. Zero dependencies, one file, its own palette.

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

<Alert002
  tone="danger"
  title="Payment failed"
  description="The bank declined the charge."
  action={<a href="/billing">Update card</a>}
/>

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 local --vibeui-alert-002-* palette — do not swap it for your theme tokens (bg-destructive, text-destructive-foreground and the like)
- the full fill: it is the whole point of this variant — weaken it and you get alert-001, which already exists
- the glyph outlined in currentColor: a second colour on the fill reads as dirt
- the muted description shade drawn from the same tone rather than grey: grey on a coloured fill looks washed out
- picking the role from the tone: danger is role="alert", the rest are role="status"
- the @container query that moves the action below the text in a narrow column
- the <style> block inside the component — it holds the palette, the tones and the layout

## 6. You may change
- tone: info, success, warning, danger
- the title and description copy
- action — a ReactNode: a link or your own button
- width and outer spacing through className

## 7. Rules
- Only one of these belongs on screen. Two filled blocks side by side cancel out and become background.
- Do not use it for hints and tips: the fill promises an urgency that is not there.
- For a calm message in the page flow use alert-001, where the tone lives in a bar rather than a fill.
- 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-002.json
https://vibeui.ru/r/alert-002.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-alert-002-*. Четыре тона переключаются data-атрибутом и меняют фон, цвет текста и приглушённый оттенок описания разом. Значок нарисован обводкой currentColor, поэтому на любой заливке остаётся читаемым без второго цвета. Роль выбирается по тону: danger объявляется как alert, остальные — как status. В узкой колонке действие переносится под текст через @container.

Component source

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

import type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from "react"

export type Alert002Tone = "info" | "success" | "warning" | "danger"

export type Alert002Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "title" | "children"
> & {
  tone?: Alert002Tone
  title?: string
  description?: string
  /** Ссылка справа: «Подробнее», «Открыть журнал». */
  action?: ReactNode
}

// Идея компонента: залитый алерт — самый тяжёлый вес в наборе. Он для того
// единственного случая, когда сообщение нельзя пропустить: сервис лежит,
// оплата не прошла, данные вот-вот удалятся. Заливка тоном по всей площади
// сознательно кричит, поэтому такой алерт на экране должен быть один.
const STYLES = `
:where([data-vibeui-block="alert-002"]){
--vibeui-alert-002-bg:oklch(0.55 0.19 25);
--vibeui-alert-002-fg:oklch(0.99 0.01 25);
--vibeui-alert-002-muted:oklch(0.93 0.03 25);
--vibeui-alert-002-radius:0.75rem;
--vibeui-alert-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
[data-vibeui-block="alert-002"]{
/* flex-wrap живёт здесь, а не в @container: контейнерный запрос применяется
   к потомкам контейнера, но не к нему самому. На широкой раскладке перенос
   ни на что не влияет — всё умещается в строку. */
display:flex;flex-wrap:wrap;align-items:flex-start;gap:0.75rem;
width:100%;box-sizing:border-box;
padding:0.875rem 1rem;border-radius:var(--vibeui-alert-002-radius);
background:var(--vibeui-alert-002-bg);color:var(--vibeui-alert-002-fg);
font-family:var(--vibeui-alert-002-font);
}
[data-vibeui-block="alert-002"][data-tone="info"]{--vibeui-alert-002-bg:oklch(0.5 0.18 262);--vibeui-alert-002-fg:oklch(0.99 0.01 262);--vibeui-alert-002-muted:oklch(0.9 0.04 262)}
[data-vibeui-block="alert-002"][data-tone="success"]{--vibeui-alert-002-bg:oklch(0.5 0.14 152);--vibeui-alert-002-fg:oklch(0.99 0.01 152);--vibeui-alert-002-muted:oklch(0.9 0.04 152)}
[data-vibeui-block="alert-002"][data-tone="warning"]{--vibeui-alert-002-bg:oklch(0.62 0.15 70);--vibeui-alert-002-fg:oklch(0.99 0.01 70);--vibeui-alert-002-muted:oklch(0.94 0.04 70)}
/* Значок на просвете заливки: обводка вместо второго цвета. */
[data-vibeui-block="alert-002"] [data-part="icon"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:1.375rem;height:1.375rem;margin-top:0.0625rem;
border:1.5px solid currentColor;border-radius:9999px;
font-size:0.75rem;font-weight:800;line-height:1;
}
[data-vibeui-block="alert-002"] [data-part="text"]{display:flex;flex-direction:column;gap:0.1875rem;flex:1 1 auto;min-width:0}
[data-vibeui-block="alert-002"] [data-part="title"]{font-size:0.875rem;font-weight:650;line-height:1.4}
[data-vibeui-block="alert-002"] [data-part="description"]{font-size:0.8125rem;line-height:1.5;color:var(--vibeui-alert-002-muted)}
[data-vibeui-block="alert-002"] [data-part="action"]{
flex:none;align-self:center;
color:inherit;font-size:0.8125rem;font-weight:650;text-decoration:none;
border-bottom:1px solid color-mix(in oklab,currentColor 45%,transparent);
transition:border-color .16s ease;
}
[data-vibeui-block="alert-002"] [data-part="action"]:hover{border-bottom-color:currentColor}
[data-vibeui-block="alert-002"] a:focus-visible,
[data-vibeui-block="alert-002"] button:focus-visible{outline:2px solid currentColor;outline-offset:2px}
@container (max-width: 26rem){
/* Текст занимает строку целиком, иначе действие сжимает его до нуля. */
[data-vibeui-block="alert-002"] [data-part="text"]{flex:1 1 100%}
[data-vibeui-block="alert-002"] [data-part="action"]{width:100%;align-self:flex-start;padding-left:2.125rem}
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="alert-002"] *{animation:none!important;transition:none!important}}
`

const GLYPHS: Record<Alert002Tone, string> = {
  info: "i",
  success: "✓",
  warning: "!",
  danger: "!",
}

/**
 * Залитый алерт для сообщений, которые нельзя пропустить.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Alert002({
  tone = "danger",
  title = "Оплата не прошла",
  description = "Банк отклонил списание. Проект останется опубликованным ещё 5 дней, потом перейдёт в режим только для чтения.",
  action = "Обновить карту",
  className,
  style,
  ...props
}: Alert002Props) {
  return (
    <>
      <style href="vibeui-alert-002" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="alert-002"
        data-tone={tone}
        role={tone === "danger" ? "alert" : "status"}
        className={className}
        style={style as CSSProperties}
      >
        <span data-part="icon" aria-hidden="true">
          {GLYPHS[tone]}
        </span>
        <span data-part="text">
          {title ? <span data-part="title">{title}</span> : null}
          {description ? (
            <span data-part="description">{description}</span>
          ) : null}
        </span>
        {action ? <span data-part="action">{action}</span> : null}
      </div>
    </>
  )
}