Dialog
Destructive Dialog
A dialog for irreversible deletion: a list of what disappears instead of the line "all data". Specifics are the only thing that makes people stop.
- dialog
- confirm
- destructive
- no-js
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/dialog-002?lang=en
Delete the project “Studio site”?
Действие необратимо: восстановить проект из резервной копии мы не сможем.
- 18 страниц и вся история публикаций
- домен studio-polet.ru и его сертификат
- доступы четырёх участников
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 "dialog-002" (Destructive Dialog) 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/dialog-002.json
Registry item: https://vibeui.ru/r/dialog-002.json
Installs to: components/vibeui/dialog-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 dialog for irreversible deletion: a list of what disappears instead of the line "all data". Specifics are the only thing that makes people stop.
A modal for an irreversible action: a round mark, a heading, an explanation and a list of what will be lost. Cancel sits on the left as the easy way out, the red confirm on the right. Opening and closing come from the HTML popover attribute, with no JS at all. Zero dependencies, one file, its own palette.
## 3. How to use it
import { Dialog002 } from "@/components/vibeui/dialog-002"
<Dialog002
id="delete-project"
title="Delete this project?"
losses={["18 pages", "the domain and its certificate"]}
/>
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-dialog-002-* palette — do not swap it for your theme tokens (bg-destructive, bg-background and the like)
- the list of losses: "all data will be deleted" does not stop anyone, three concrete lines do
- the popover mechanism: popovertarget and popover="auto" supply Esc and click-outside
- styling the window by attribute and passing the palette through its own style: in the top layer it is no longer a descendant of the root
- role="alertdialog" and the aria-labelledby tying the window to its heading
- the button order: cancel first — with an irreversible action the exit must be within reach
## 6. You may change
- id — one per dialog on the page
- the title, description and button copy
- losses — what will disappear
- the confirm handler: attach onClick to the confirm button in your copy
- trigger — the label of the button that opens the dialog
## 7. Rules
- popover="auto" closes on an outside click. For a window that must not be dismissed by accident use dialog-006 with popover="manual".
- This is not <dialog>: the rest of the page does not become inert. Payments and signatures need a real showModal.
- If the target can be confused with another, add a name-typing step as in alert-020.
- 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/dialog-002.jsonhttps://vibeui.ru/r/dialog-002.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-dialog-002-*. Открытие держит HTML popover: Esc, клик мимо, ::backdrop и верхний слой достаются от браузера, клиентского кода нет. Окно живёт в верхнем слое и потому стилизуется по атрибуту [data-vibeui-dialog-002-window] и получает палитру собственным style — наследование по вложенности там не работает. Роль alertdialog.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { CSSProperties } from "react"
export type Dialog002Props = {
id?: string
trigger?: string
title?: string
description?: string
/** Что именно исчезнет: перечень, а не одна строка «все данные». */
losses?: string[]
confirmLabel?: string
cancelLabel?: string
className?: string
style?: CSSProperties
}
// Идея компонента: окно необратимого действия. В отличие от обычного
// подтверждения здесь перечислено, что именно исчезнет: конкретика — то
// единственное, что заставляет остановиться. Отмена стоит первой и остаётся
// простым выходом, подтверждение красное и стоит справа.
//
// Открытие держит HTML popover: Esc, клик мимо, подложка и верхний слой
// достаются от браузера. Окно живёт в верхнем слое, поэтому стилизуется по
// атрибуту и получает палитру собственным style.
const STYLES = `
:where([data-vibeui-block="dialog-002"]){
--vibeui-dialog-002-fg:oklch(0.22 0.016 265);
--vibeui-dialog-002-muted:oklch(0.5 0.014 265);
--vibeui-dialog-002-bg:oklch(1 0 0);
--vibeui-dialog-002-border:oklch(0.9 0.006 265);
--vibeui-dialog-002-danger:oklch(0.56 0.19 25);
--vibeui-dialog-002-radius:1rem;
--vibeui-dialog-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="dialog-002"]{display:inline-flex;font-family:var(--vibeui-dialog-002-font)}
[data-vibeui-block="dialog-002"] [data-part="trigger"]{
appearance:none;cursor:pointer;font:inherit;font-size:0.875rem;font-weight:600;
display:inline-flex;align-items:center;height:2.25rem;padding:0 0.9375rem;
border:1px solid color-mix(in oklab,var(--vibeui-dialog-002-danger) 35%,transparent);
border-radius:0.5rem;
background:color-mix(in oklab,var(--vibeui-dialog-002-danger) 8%,transparent);
color:var(--vibeui-dialog-002-danger);
transition:background-color .16s ease;
}
[data-vibeui-block="dialog-002"] [data-part="trigger"]:hover{background:color-mix(in oklab,var(--vibeui-dialog-002-danger) 14%,transparent)}
[data-vibeui-block="dialog-002"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-dialog-002-danger);outline-offset:2px}
[data-vibeui-dialog-002-window]{
position:fixed;inset:0;margin:auto;height:fit-content;
width:min(28rem,calc(100vw - 2rem));box-sizing:border-box;
padding:1.5rem;
border:1px solid var(--vibeui-dialog-002-border,oklch(0.9 0.006 265));
border-radius:var(--vibeui-dialog-002-radius,1rem);
background:var(--vibeui-dialog-002-bg,oklch(1 0 0));
color:var(--vibeui-dialog-002-fg,oklch(0.22 0.016 265));
font-family:var(--vibeui-dialog-002-font,ui-sans-serif,system-ui,sans-serif);
box-shadow:0 24px 60px -24px oklch(0.2 0.03 265 / 45%);
opacity:0;transform:scale(0.97);
transition:opacity .18s ease,transform .18s ease,display .18s allow-discrete,overlay .18s allow-discrete;
}
[data-vibeui-dialog-002-window]:popover-open{opacity:1;transform:none}
@starting-style{[data-vibeui-dialog-002-window]:popover-open{opacity:0;transform:scale(0.97)}}
[data-vibeui-dialog-002-window]::backdrop{background:oklch(0.18 0.02 265 / 50%);backdrop-filter:blur(2px)}
/* Значок в круге: окно про удаление узнают до чтения заголовка. */
[data-vibeui-dialog-002-window] [data-part="mark"]{
display:flex;align-items:center;justify-content:center;
width:2.5rem;height:2.5rem;margin-bottom:0.875rem;border-radius:9999px;
background:color-mix(in oklab,var(--vibeui-dialog-002-danger,oklch(0.56 0.19 25)) 14%,transparent);
color:var(--vibeui-dialog-002-danger,oklch(0.56 0.19 25));
font-size:1.125rem;font-weight:800;line-height:1;
}
[data-vibeui-dialog-002-window] [data-part="title"]{margin:0 0 0.375rem;font-size:1.0625rem;font-weight:650;line-height:1.35}
[data-vibeui-dialog-002-window] [data-part="description"]{margin:0;font-size:0.875rem;line-height:1.55;color:var(--vibeui-dialog-002-muted,oklch(0.5 0.014 265))}
[data-vibeui-dialog-002-window] ul{margin:0.875rem 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:0.25rem}
[data-vibeui-dialog-002-window] li{
position:relative;padding-left:1rem;
font-size:0.8125rem;line-height:1.5;color:var(--vibeui-dialog-002-muted,oklch(0.5 0.014 265));
}
[data-vibeui-dialog-002-window] li::before{
content:"";position:absolute;left:0;top:0.5rem;width:0.3125rem;height:0.3125rem;
border-radius:9999px;background:color-mix(in oklab,var(--vibeui-dialog-002-danger,oklch(0.56 0.19 25)) 55%,transparent);
}
[data-vibeui-dialog-002-window] [data-part="actions"]{display:flex;justify-content:flex-end;gap:0.5rem;margin-top:1.375rem}
[data-vibeui-dialog-002-window] button{
appearance:none;cursor:pointer;font:inherit;font-size:0.875rem;font-weight:600;
display:inline-flex;align-items:center;height:2.25rem;padding:0 1rem;
border-radius:0.5rem;border:1px solid transparent;
transition:background-color .16s ease,border-color .16s ease;
}
[data-vibeui-dialog-002-window] [data-part="cancel"]{
background:transparent;color:inherit;
border-color:var(--vibeui-dialog-002-border,oklch(0.9 0.006 265));
}
[data-vibeui-dialog-002-window] [data-part="cancel"]:hover{background:color-mix(in oklab,var(--vibeui-dialog-002-border,oklch(0.9 0.006 265)) 40%,transparent)}
[data-vibeui-dialog-002-window] [data-part="confirm"]{
background:var(--vibeui-dialog-002-danger,oklch(0.56 0.19 25));color:oklch(0.99 0.01 25);
}
[data-vibeui-dialog-002-window] [data-part="confirm"]:hover{filter:brightness(0.94)}
[data-vibeui-dialog-002-window] button:focus-visible{outline:2px solid var(--vibeui-dialog-002-danger,oklch(0.56 0.19 25));outline-offset:2px}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="dialog-002"] *{animation:none!important;transition:none!important}
[data-vibeui-dialog-002-window]{transition:none!important;opacity:1;transform:none}
}
`
const DEFAULT_LOSSES = [
"18 страниц и вся история публикаций",
"домен studio-polet.ru и его сертификат",
"доступы четырёх участников",
]
/**
* Окно необратимого удаления: перечень потерь и красное подтверждение.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Dialog002({
id = "vibeui-dialog-002",
trigger = "Удалить проект",
title = "Удалить проект «Сайт студии»?",
description = "Действие необратимо: восстановить проект из резервной копии мы не сможем.",
losses = DEFAULT_LOSSES,
confirmLabel = "Удалить навсегда",
cancelLabel = "Отмена",
className,
style,
}: Dialog002Props) {
return (
<>
<style href="vibeui-dialog-002" precedence="medium">
{STYLES}
</style>
<div data-vibeui-block="dialog-002" className={className} style={style}>
<button data-part="trigger" type="button" popoverTarget={id}>
{trigger}
</button>
<div
id={id}
popover="auto"
data-vibeui-dialog-002-window=""
role="alertdialog"
aria-labelledby={`${id}-title`}
style={style}
>
<span data-part="mark" aria-hidden="true">
!
</span>
<h2 data-part="title" id={`${id}-title`}>
{title}
</h2>
<p data-part="description">{description}</p>
{losses.length ? (
<ul>
{losses.map((loss) => (
<li key={loss}>{loss}</li>
))}
</ul>
) : null}
<div data-part="actions">
<button data-part="cancel" type="button" popoverTarget={id}>
{cancelLabel}
</button>
<button data-part="confirm" type="button" popoverTarget={id}>
{confirmLabel}
</button>
</div>
</div>
</div>
</>
)
}