Alert
Grouped Alerts
Several messages in one frame instead of a stack of separate ones: a shared heading, a single Clear button, and the tail folded into a counter row.
- alert
- notifications
- list
- inbox
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-016?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-016" (Grouped Alerts) 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-016.json
Registry item: https://vibeui.ru/r/alert-016.json
Installs to: components/vibeui/alert-016.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
Several messages in one frame instead of a stack of separate ones: a shared heading, a single Clear button, and the tail folded into a counter row.
A group of messages in one frame: a header with a title and a count, entries with tone dots, time and description, and a folded tail. Five separate alerts in a row form a wall people scroll past; here they share a frame and one clear button. Zero dependencies, one file, its own palette.
## 3. How to use it
import { Alert016 } from "@/components/vibeui/alert-016"
<Alert016
title="Notifications"
entries={[{ tone: "success", title: "Project published", time: "2m" }]}
onClear={clearAll}
/>
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-016-* palette — do not swap it for your theme tokens (bg-muted, border-border and the like)
- the shared frame instead of a stack of cards: that is the whole variant
- colour on the dot only: four coloured rows in a row turn the list into litter
- folding the tail into a counter row: the block must not grow without end
- one clear button for the group rather than a cross on every entry
- rules between entries instead of gaps — they hold the list as a single object
- the <style> block inside the component — it holds the palette and the layout
## 6. You may change
- the entries array: tone, title, description and time
- title — the group heading; the count beside it is computed
- visible — how many entries show before folding
- onClear and clearLabel — clearing the group
- width and outer spacing through className
## 7. Rules
- This is not a notification centre: there is no read state, no filters and no pagination. Those need their own page.
- The entries arrive as a ready array — sorting and de-duplication belong to the caller.
- Do not set visible above five: past that the group stops reading as one message.
- 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-016.jsonhttps://vibeui.ru/r/alert-016.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-alert-016-*. Записи разделены линиями, а не отступами: общая рамка держит их как один объект. Тон каждой записи задаётся data-атрибутом и меняет только цвет точки. Хвост длиннее visible сворачивается в строку со счётчиком, поэтому блок не растёт бесконечно.
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 Alert016Tone = "info" | "success" | "warning" | "danger"
export type Alert016Entry = {
tone?: Alert016Tone
title: string
description?: string
time?: string
}
export type Alert016Props = Omit<
ComponentPropsWithoutRef<"div">,
"title" | "children"
> & {
title?: string
entries?: Alert016Entry[]
/** Сколько записей показывать: остальные сворачиваются в строку-счётчик. */
visible?: number
clearLabel?: string
onClear?: () => void
}
// Идея компонента: несколько сообщений в одной рамке вместо стопки отдельных
// алертов. Пять карточек подряд — это стена, которую пролистывают; здесь у
// них общая рамка, общий заголовок и одна кнопка «очистить». Лишние записи
// сворачиваются в строку со счётчиком, а не растягивают блок.
const STYLES = `
:where([data-vibeui-block="alert-016"]){
--vibeui-alert-016-fg:oklch(0.22 0.014 265);
--vibeui-alert-016-muted:oklch(0.5 0.014 265);
--vibeui-alert-016-bg:oklch(1 0 0);
--vibeui-alert-016-border:oklch(0.9 0.006 265);
--vibeui-alert-016-tone:oklch(0.58 0.18 262);
--vibeui-alert-016-radius:0.875rem;
--vibeui-alert-016-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="alert-016"]{
display:flex;flex-direction:column;
width:100%;box-sizing:border-box;overflow:hidden;
border:1px solid var(--vibeui-alert-016-border);
border-radius:var(--vibeui-alert-016-radius);
background:var(--vibeui-alert-016-bg);color:var(--vibeui-alert-016-fg);
font-family:var(--vibeui-alert-016-font);
}
[data-vibeui-block="alert-016"] [data-part="head"]{
display:flex;align-items:center;justify-content:space-between;gap:1rem;
padding:0.6875rem 1rem;border-bottom:1px solid var(--vibeui-alert-016-border);
background:oklch(0.985 0.002 265);
}
[data-vibeui-block="alert-016"] [data-part="head-title"]{font-size:0.8125rem;font-weight:650}
[data-vibeui-block="alert-016"] [data-part="clear"]{
appearance:none;border:0;background:none;cursor:pointer;padding:0;
color:var(--vibeui-alert-016-muted);font:inherit;font-size:0.75rem;
}
[data-vibeui-block="alert-016"] [data-part="clear"]:hover{color:var(--vibeui-alert-016-fg)}
[data-vibeui-block="alert-016"] [data-part="clear"]:focus-visible{outline:2px solid var(--vibeui-alert-016-tone);outline-offset:2px;border-radius:0.25rem}
[data-vibeui-block="alert-016"] [data-part="entry"]{
display:flex;align-items:flex-start;gap:0.625rem;
padding:0.75rem 1rem;
}
[data-vibeui-block="alert-016"] [data-part="entry"] + [data-part="entry"]{border-top:1px solid var(--vibeui-alert-016-border)}
[data-vibeui-block="alert-016"] [data-part="entry"][data-tone="success"]{--vibeui-alert-016-tone:oklch(0.58 0.15 152)}
[data-vibeui-block="alert-016"] [data-part="entry"][data-tone="warning"]{--vibeui-alert-016-tone:oklch(0.68 0.15 70)}
[data-vibeui-block="alert-016"] [data-part="entry"][data-tone="danger"]{--vibeui-alert-016-tone:oklch(0.56 0.19 25)}
[data-vibeui-block="alert-016"] [data-part="dot"]{
flex:none;width:0.4375rem;height:0.4375rem;margin-top:0.4375rem;
border-radius:9999px;background:var(--vibeui-alert-016-tone);
}
[data-vibeui-block="alert-016"] [data-part="text"]{display:flex;flex-direction:column;gap:0.0625rem;flex:1 1 auto;min-width:0}
[data-vibeui-block="alert-016"] [data-part="title"]{font-size:0.875rem;font-weight:550;line-height:1.4}
[data-vibeui-block="alert-016"] [data-part="description"]{font-size:0.8125rem;line-height:1.5;color:var(--vibeui-alert-016-muted)}
[data-vibeui-block="alert-016"] [data-part="time"]{
flex:none;font-size:0.75rem;color:var(--vibeui-alert-016-muted);white-space:nowrap;
}
/* Хвост списка сворачивается в строку: стопка не должна расти бесконечно. */
[data-vibeui-block="alert-016"] [data-part="more"]{
padding:0.625rem 1rem;border-top:1px solid var(--vibeui-alert-016-border);
font-size:0.75rem;color:var(--vibeui-alert-016-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="alert-016"] *{animation:none!important;transition:none!important}}
`
const DEFAULT_ENTRIES: Alert016Entry[] = [
{
tone: "success",
title: "Проект опубликован",
description: "Изменения видны по адресу проекта.",
time: "2 мин",
},
{
tone: "warning",
title: "Домен подтверждается",
description: "DNS-запись найдена, ждём сертификат.",
time: "18 мин",
},
{
tone: "danger",
title: "Сборка страницы «Услуги» упала",
description: "Прошлая версия продолжает работать.",
time: "1 ч",
},
{
title: "Приглашён участник",
description: "anna@studio.ru — роль редактора.",
time: "3 ч",
},
]
/**
* Несколько сообщений в одной рамке: общий заголовок и свёрнутый хвост.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Alert016({
title = "Уведомления",
entries = DEFAULT_ENTRIES,
visible = 3,
clearLabel = "Очистить",
onClear,
className,
style,
...props
}: Alert016Props) {
const shown = entries.slice(0, Math.max(1, visible))
const rest = entries.length - shown.length
return (
<>
<style href="vibeui-alert-016" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="alert-016"
role="status"
aria-label={title}
className={className}
style={style as CSSProperties}
>
<div data-part="head">
<span data-part="head-title">
{title} · {entries.length}
</span>
{onClear && clearLabel ? (
<button data-part="clear" type="button" onClick={onClear}>
{clearLabel}
</button>
) : null}
</div>
{shown.map((entry) => (
<div
key={entry.title}
data-part="entry"
data-tone={entry.tone ?? "info"}
>
<span data-part="dot" aria-hidden="true" />
<span data-part="text">
<span data-part="title">{entry.title}</span>
{entry.description ? (
<span data-part="description">{entry.description}</span>
) : null}
</span>
{entry.time ? <span data-part="time">{entry.time}</span> : null}
</div>
))}
{rest > 0 ? <div data-part="more">Ещё {rest} — в журнале</div> : null}
</div>
</>
)
}