Dialog

Preview Dialog

A dialog with a full-bleed cover: the image meets the edges while the content keeps its padding. The cover is drawn with gradients — the component ships no files.

  • dialog
  • preview
  • media
  • cover

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/dialog-011?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 "dialog-011" (Preview 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-011.json

Registry item: https://vibeui.ru/r/dialog-011.json
Installs to: components/vibeui/dialog-011.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 with a full-bleed cover: the image meets the edges while the content keeps its padding. The cover is drawn with gradients — the component ships no files.

A preview dialog: a 16/9 cover across the full width, then the heading, description, a specs line and two buttons. The cover is gradients, so the component drags no assets along. Zero dependencies, one file, its own palette.

## 3. How to use it
import { Dialog011 } from "@/components/vibeui/dialog-011"

<Dialog011
  id="page-preview"
  title="Home page"
  meta="1440 × 900 · 320 KB"
  primaryLabel="Publish"
/>

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-011-* palette — do not swap it for your theme tokens (bg-card, bg-muted and the like)
- the window's zero padding together with overflow:hidden: only then does the cover meet the rounded edges
- the 16/9 ratio on the cover — keep it when swapping in an <img>, or the window jumps as it loads
- the darkening at the bottom of the cover: without it a light image merges into the body
- the specs line in tabular figures
- styling the window by attribute and the palette through its own style — the window sits in the top layer

## 6. You may change
- the title, description and meta copy
- primaryLabel and primaryHref — the main action
- the cover: replace [data-part="cover"] with an <img> at the same aspect-ratio
- the accent through the accent prop — the cover tint and the main button

## 7. Rules
- Do not stretch the window for a large image: a preview should stay a preview, not become a viewer.
- An <img> cover needs an alt — otherwise a screen reader announces emptiness instead of the description.
- The component loads no images and shows no loading state.
- 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-011.json
https://vibeui.ru/r/dialog-011.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-dialog-011-*. У окна нулевой padding и overflow:hidden, поэтому обложка упирается в скруглённые края; отступы живут во внутреннем [data-part="body"]. Обложка держит пропорцию 16/9 и собрана из двух градиентов с затемнением снизу — заменить её на <img> можно, не трогая раскладку.

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 Dialog011Props = {
  id?: string
  trigger?: string
  title?: string
  description?: string
  /** Подпись под обложкой: размер, разрешение, дата. */
  meta?: string
  primaryLabel?: string
  primaryHref?: string
  closeLabel?: string
  accent?: string
  className?: string
  style?: CSSProperties
}

// Идея компонента: окно с обложкой сверху. Картинка занимает всю ширину и
// упирается в края — поэтому у окна нет внутреннего отступа сверху, а
// содержимое получает свой. Обложка нарисована градиентами: у компонента не
// может быть внешних файлов, а заглушка-серый прямоугольник выглядит поломкой.
const STYLES = `
:where([data-vibeui-block="dialog-011"]){
--vibeui-dialog-011-fg:oklch(0.22 0.016 265);
--vibeui-dialog-011-muted:oklch(0.5 0.014 265);
--vibeui-dialog-011-bg:oklch(1 0 0);
--vibeui-dialog-011-border:oklch(0.89 0.006 265);
--vibeui-dialog-011-accent:oklch(0.55 0.2 262);
--vibeui-dialog-011-radius:1rem;
--vibeui-dialog-011-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="dialog-011"]{display:inline-flex;font-family:var(--vibeui-dialog-011-font)}
[data-vibeui-block="dialog-011"] [data-part="trigger"]{
appearance:none;cursor:pointer;font:inherit;font-size:0.875rem;font-weight:500;
display:inline-flex;align-items:center;height:2.25rem;padding:0 0.9375rem;
border:1px solid var(--vibeui-dialog-011-border);border-radius:0.5rem;
background:var(--vibeui-dialog-011-bg);color:var(--vibeui-dialog-011-fg);
}
[data-vibeui-block="dialog-011"] [data-part="trigger"]:hover{background:color-mix(in oklab,var(--vibeui-dialog-011-border) 30%,transparent)}
[data-vibeui-block="dialog-011"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-dialog-011-accent);outline-offset:2px}
[data-vibeui-dialog-011-window]{
position:fixed;inset:0;margin:auto;height:fit-content;
width:min(26rem,calc(100vw - 2rem));box-sizing:border-box;padding:0;overflow:hidden;
border:1px solid var(--vibeui-dialog-011-border,oklch(0.89 0.006 265));
border-radius:var(--vibeui-dialog-011-radius,1rem);
background:var(--vibeui-dialog-011-bg,oklch(1 0 0));
color:var(--vibeui-dialog-011-fg,oklch(0.22 0.016 265));
font-family:var(--vibeui-dialog-011-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-011-window]:popover-open{opacity:1;transform:none}
@starting-style{[data-vibeui-dialog-011-window]:popover-open{opacity:0;transform:scale(0.97)}}
[data-vibeui-dialog-011-window]::backdrop{background:oklch(0.18 0.02 265 / 50%);backdrop-filter:blur(2px)}
/* Обложка градиентами: внешних файлов у компонента быть не может. */
[data-vibeui-dialog-011-window] [data-part="cover"]{
position:relative;aspect-ratio:16 / 9;
background:
radial-gradient(110% 90% at 18% 10%,color-mix(in oklab,var(--vibeui-dialog-011-accent,oklch(0.55 0.2 262)) 55%,transparent),transparent 62%),
linear-gradient(155deg,oklch(0.93 0.03 265),oklch(0.84 0.05 250));
}
[data-vibeui-dialog-011-window] [data-part="cover"]::after{
content:"";position:absolute;inset:auto 0 0;height:35%;
background:linear-gradient(to top,oklch(0.2 0.02 265 / 22%),transparent);
}
[data-vibeui-dialog-011-window] [data-part="body"]{padding:1.125rem 1.25rem 1.25rem}
[data-vibeui-dialog-011-window] [data-part="title"]{margin:0 0 0.25rem;font-size:1.0625rem;font-weight:640;line-height:1.3}
[data-vibeui-dialog-011-window] [data-part="description"]{margin:0;font-size:0.875rem;line-height:1.55;color:var(--vibeui-dialog-011-muted,oklch(0.5 0.014 265))}
[data-vibeui-dialog-011-window] [data-part="meta"]{
display:block;margin-top:0.625rem;font-size:0.75rem;
color:var(--vibeui-dialog-011-muted,oklch(0.5 0.014 265));font-variant-numeric:tabular-nums;
}
[data-vibeui-dialog-011-window] [data-part="actions"]{display:flex;justify-content:flex-end;gap:0.5rem;margin-top:1.125rem}
[data-vibeui-dialog-011-window] [data-part="close"],
[data-vibeui-dialog-011-window] [data-part="primary"]{
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;text-decoration:none;
}
[data-vibeui-dialog-011-window] [data-part="close"]{background:transparent;color:inherit;border-color:var(--vibeui-dialog-011-border,oklch(0.89 0.006 265))}
[data-vibeui-dialog-011-window] [data-part="primary"]{background:var(--vibeui-dialog-011-accent,oklch(0.55 0.2 262));color:oklch(1 0 0)}
[data-vibeui-dialog-011-window] [data-part="primary"]:hover{filter:brightness(0.94)}
[data-vibeui-dialog-011-window] :focus-visible{outline:2px solid var(--vibeui-dialog-011-accent,oklch(0.55 0.2 262));outline-offset:2px}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="dialog-011"] *{animation:none!important;transition:none!important}
[data-vibeui-dialog-011-window]{transition:none!important;opacity:1;transform:none}
}
`

/**
 * Окно с обложкой во всю ширину: превью материала и действие.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Dialog011({
  id = "vibeui-dialog-011",
  trigger = "Открыть превью",
  title = "Главная страница",
  description = "Черновик с изменениями от 12 марта. Опубликованная версия отличается блоком тарифов.",
  meta = "1440 × 900 · 320 КБ · 12 марта, 14:08",
  primaryLabel = "Опубликовать",
  primaryHref = "#",
  closeLabel = "Закрыть",
  accent,
  className,
  style,
}: Dialog011Props) {
  const palette = {
    ...(accent ? { "--vibeui-dialog-011-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-dialog-011" precedence="medium">
        {STYLES}
      </style>
      <div data-vibeui-block="dialog-011" className={className} style={palette}>
        <button data-part="trigger" type="button" popoverTarget={id}>
          {trigger}
        </button>
        <div
          id={id}
          popover="auto"
          data-vibeui-dialog-011-window=""
          role="dialog"
          aria-labelledby={`${id}-title`}
          style={palette}
        >
          <div data-part="cover" aria-hidden="true" />
          <div data-part="body">
            <h2 data-part="title" id={`${id}-title`}>
              {title}
            </h2>
            {description ? <p data-part="description">{description}</p> : null}
            {meta ? <span data-part="meta">{meta}</span> : null}
            <div data-part="actions">
              <button data-part="close" type="button" popoverTarget={id}>
                {closeLabel}
              </button>
              {primaryLabel ? (
                <a data-part="primary" href={primaryHref}>
                  {primaryLabel}
                </a>
              ) : null}
            </div>
          </div>
        </div>
      </div>
    </>
  )
}