Alert
Inline Alert
An inline alert where the tone lives in the left bar and the icon rather than a full-width fill. Three of them in a row do not turn the screen into traffic lights.
- alert
- notification
- inline
- status
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/alert-001?lang=en
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-001" (Inline 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-001.json
Registry item: https://vibeui.ru/r/alert-001.json
Installs to: components/vibeui/alert-001.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
An inline alert where the tone lives in the left bar and the icon rather than a full-width fill. Three of them in a row do not turn the screen into traffic lights.
An inline alert: a tone bar on the left, a round glyph, a title, a description and an action on the right. The colour stays in the bar and the glyph while the background stays neutral, so several alerts read calmly. Four tones, role status or alert depending on the tone, and the action wraps in a narrow column. Zero dependencies, one file, its own palette.
## 3. How to use it
import { Alert001 } from "@/components/vibeui/alert-001"
<Alert001
tone="warning"
title="No domain connected yet"
description="The site is served from a temporary address."
action={<a href="/domains">Connect</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-001-* palette — do not swap it for your theme tokens (bg-destructive, text-destructive-foreground and the like)
- the core decision: the tone colours the bar and the glyph, it does not flood the alert
- picking the role from the tone: danger is role="alert", the rest are role="status"; a permanent alert makes a screen reader interrupt for every trifle
- the bar through ::before together with overflow:hidden — otherwise it escapes the rounded corner
- the glyph as a separate aria-hidden element: the text carries the meaning
- the @container query that moves the action below the text: in a narrow column the title collapses otherwise
- 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 is a ReactNode: put a link or your own button in it
- width and outer spacing through className: by default the alert fills its parent
## 7. Rules
- Do not use this as a floating notification: it belongs in the page flow. Floating needs a toast.
- Do not stack more than two alerts: the third one stops being read.
- Never rely on colour alone — the title has to say what happened.
- 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-001.jsonhttps://vibeui.ru/r/alert-001.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-alert-001-*. Четыре тона переключаются data-атрибутом и меняют одну переменную: цвет полосы слева и значка. Роль выбирается по тону: 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 Alert001Tone = "info" | "success" | "warning" | "danger"
export type Alert001Props = Omit<
ComponentPropsWithoutRef<"div">,
"title" | "children"
> & {
tone?: Alert001Tone
title?: string
description?: string
/** Действие справа: ссылка «Подробнее», кнопка «Повторить». */
action?: ReactNode
}
// Идея компонента: тон несёт полоса слева и значок, а не заливка во всю
// ширину. Уведомление остаётся частью страницы, а не куском чужого интерфейса,
// и три сообщения подряд не превращают экран в светофор.
const STYLES = `
:where([data-vibeui-block="alert-001"]){
--vibeui-alert-001-fg:oklch(0.26 0.016 265);
--vibeui-alert-001-muted:oklch(0.48 0.014 265);
--vibeui-alert-001-bg:oklch(0.985 0.002 265);
--vibeui-alert-001-border:oklch(0.9 0.006 265);
--vibeui-alert-001-tone:oklch(0.58 0.18 262);
--vibeui-alert-001-radius:0.75rem;
--vibeui-alert-001-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
container-type:inline-size;
}
[data-vibeui-block="alert-001"]{
/* flex-wrap живёт здесь, а не в @container: контейнерный запрос применяется
к потомкам контейнера, но не к нему самому. На широкой раскладке перенос
ни на что не влияет — всё умещается в строку. */
position:relative;display:flex;flex-wrap:wrap;align-items:flex-start;gap:0.75rem;
width:100%;box-sizing:border-box;overflow:hidden;
padding:0.875rem 1rem 0.875rem 1.125rem;
border:1px solid var(--vibeui-alert-001-border);
border-radius:var(--vibeui-alert-001-radius);
background:var(--vibeui-alert-001-bg);color:var(--vibeui-alert-001-fg);
font-family:var(--vibeui-alert-001-font);
}
/* Полоса слева — единственное место, где виден тон. */
[data-vibeui-block="alert-001"]::before{
content:"";position:absolute;left:0;top:0;bottom:0;width:3px;
background:var(--vibeui-alert-001-tone);
}
[data-vibeui-block="alert-001"] [data-part="icon"]{
display:flex;align-items:center;justify-content:center;flex:none;
width:1.25rem;height:1.25rem;margin-top:0.0625rem;
border-radius:9999px;
background:color-mix(in oklab,var(--vibeui-alert-001-tone) 18%,transparent);
color:var(--vibeui-alert-001-tone);
font-size:0.75rem;font-weight:700;line-height:1;
}
[data-vibeui-block="alert-001"] [data-part="text"]{display:flex;flex-direction:column;gap:0.1875rem;flex:1 1 auto;min-width:0}
[data-vibeui-block="alert-001"] [data-part="title"]{font-size:0.875rem;font-weight:600;line-height:1.4}
[data-vibeui-block="alert-001"] [data-part="description"]{font-size:0.8125rem;line-height:1.5;color:var(--vibeui-alert-001-muted)}
[data-vibeui-block="alert-001"] [data-part="action"]{
display:flex;align-items:center;flex:none;gap:0.5rem;
font-size:0.8125rem;font-weight:500;color:var(--vibeui-alert-001-tone);
}
[data-vibeui-block="alert-001"][data-tone="success"]{--vibeui-alert-001-tone:oklch(0.58 0.15 152)}
[data-vibeui-block="alert-001"][data-tone="warning"]{--vibeui-alert-001-tone:oklch(0.68 0.15 70)}
[data-vibeui-block="alert-001"][data-tone="danger"]{--vibeui-alert-001-tone:oklch(0.56 0.19 25)}
/* В узкой колонке действие уходит под текст, а не сжимает его. */
@container (max-width: 26rem){
/* Текст занимает строку целиком, иначе действие сжимает его до нуля. */
[data-vibeui-block="alert-001"] [data-part="text"]{flex:1 1 100%}
[data-vibeui-block="alert-001"] [data-part="action"]{width:100%;padding-left:2rem}
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="alert-001"] *{animation:none!important;transition:none!important}}
`
const GLYPHS: Record<Alert001Tone, string> = {
info: "i",
success: "✓",
warning: "!",
danger: "!",
}
/**
* Встроенное уведомление: тон несёт полоса слева, а не заливка.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Alert001({
tone = "warning",
title = "Домен ещё не подключён",
description = "Сайт открывается по временному адресу. Подключите домен, чтобы им можно было делиться.",
action = "Подключить",
className,
style,
...props
}: Alert001Props) {
return (
<>
<style href="vibeui-alert-001" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="alert-001"
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>
</>
)
}