Dialog

Feedback Dialog

A feedback dialog: the rating is words rather than stars — a bare "three" means nothing to the person answering or to the one reading the answers.

  • dialog
  • feedback
  • survey
  • rating

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-013?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-013" (Feedback 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-013.json

Registry item: https://vibeui.ru/r/dialog-013.json
Installs to: components/vibeui/dialog-013.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 feedback dialog: the rating is words rather than stars — a bare "three" means nothing to the person answering or to the one reading the answers.

A feedback window: heading, explanation, a row of worded ratings and an optional comment field. The rating uses native radios highlighted through :has, so there is no state. Zero dependencies, one file, its own palette.

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

<Dialog013
  id="feedback"
  title="How did building the page go?"
  scale={["Painful", "Tolerable", "Fine", "Smooth", "Great"]}
/>

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-013-* palette — do not swap it for your theme tokens
- worded ratings instead of stars: a numeric scale without labels is equally unclear to both sides
- the comment staying optional and placed after the rating: one tap first, words second
- the highlight through :has(input:checked) rather than state
- role="group" with a label on the rating row
- styling the window by attribute and the palette through its own style — the window sits in the top layer

## 6. You may change
- scale — the rating labels from worst to best; three or five of them
- the title, description, fieldLabel and placeholder copy
- the submitLabel and skipLabel wording
- the accent through the accent prop — the selected rating and the button

## 7. Rules
- Do not ask for feedback mid-task: a dialog in the middle of work gets dismissed unread.
- Five steps is the ceiling. With seven or more people collapse the scale to three anyway.
- The component sends nothing: read the values by name in your submit handler.
- 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-013.json
https://vibeui.ru/r/dialog-013.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-dialog-013-*. Оценка — ряд нативных radio в подписях, выбранная подсвечивается через :has(input:checked); сами radio визуально скрыты, но остаются в потоке и доступны с клавиатуры. Поле комментария необязательное и стоит после оценки: сначала одно нажатие, потом слова.

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 Dialog013Props = {
  id?: string
  trigger?: string
  title?: string
  description?: string
  /** Подписи оценок слева направо: от худшей к лучшей. */
  scale?: string[]
  fieldLabel?: string
  placeholder?: string
  submitLabel?: string
  skipLabel?: string
  accent?: string
  className?: string
  style?: CSSProperties
}

// Идея компонента: окно отзыва. Оценка — ряд нативных radio с подписями, а не
// звёзды: словами человек отвечает точнее, чем количеством звёзд, и разработчик
// потом понимает, что означала «тройка». Поле для текста необязательное и
// стоит после оценки: спросить сначала одно нажатие, потом слова.
const STYLES = `
:where([data-vibeui-block="dialog-013"]){
--vibeui-dialog-013-fg:oklch(0.22 0.016 265);
--vibeui-dialog-013-muted:oklch(0.5 0.014 265);
--vibeui-dialog-013-bg:oklch(1 0 0);
--vibeui-dialog-013-border:oklch(0.89 0.006 265);
--vibeui-dialog-013-accent:oklch(0.55 0.2 262);
--vibeui-dialog-013-radius:1rem;
--vibeui-dialog-013-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="dialog-013"]{display:inline-flex;font-family:var(--vibeui-dialog-013-font)}
[data-vibeui-block="dialog-013"] [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-013-border);border-radius:0.5rem;
background:var(--vibeui-dialog-013-bg);color:var(--vibeui-dialog-013-fg);
}
[data-vibeui-block="dialog-013"] [data-part="trigger"]:hover{background:color-mix(in oklab,var(--vibeui-dialog-013-border) 30%,transparent)}
[data-vibeui-block="dialog-013"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-dialog-013-accent);outline-offset:2px}
[data-vibeui-dialog-013-window]{
position:fixed;inset:0;margin:auto;height:fit-content;
width:min(27rem,calc(100vw - 2rem));box-sizing:border-box;padding:1.375rem;
border:1px solid var(--vibeui-dialog-013-border,oklch(0.89 0.006 265));
border-radius:var(--vibeui-dialog-013-radius,1rem);
background:var(--vibeui-dialog-013-bg,oklch(1 0 0));
color:var(--vibeui-dialog-013-fg,oklch(0.22 0.016 265));
font-family:var(--vibeui-dialog-013-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-013-window]:popover-open{opacity:1;transform:none}
@starting-style{[data-vibeui-dialog-013-window]:popover-open{opacity:0;transform:scale(0.97)}}
[data-vibeui-dialog-013-window]::backdrop{background:oklch(0.18 0.02 265 / 45%)}
[data-vibeui-dialog-013-window] [data-part="title"]{margin:0 0 0.25rem;font-size:1rem;font-weight:620;line-height:1.35}
[data-vibeui-dialog-013-window] [data-part="description"]{margin:0 0 1rem;font-size:0.8125rem;line-height:1.5;color:var(--vibeui-dialog-013-muted,oklch(0.5 0.014 265))}
[data-vibeui-dialog-013-window] [data-part="scale"]{display:flex;gap:0.375rem}
/* Оценка словами, а не звёздами: «тройка» ничего не значит без подписи. */
[data-vibeui-dialog-013-window] [data-part="grade"]{
flex:1 1 0;display:flex;align-items:center;justify-content:center;
padding:0.5rem 0.25rem;cursor:pointer;text-align:center;
border:1px solid var(--vibeui-dialog-013-border,oklch(0.89 0.006 265));
border-radius:0.625rem;font-size:0.75rem;line-height:1.3;
transition:border-color .16s ease,background-color .16s ease;
}
[data-vibeui-dialog-013-window] [data-part="grade"]:has(input:checked){
border-color:var(--vibeui-dialog-013-accent,oklch(0.55 0.2 262));
background:color-mix(in oklab,var(--vibeui-dialog-013-accent,oklch(0.55 0.2 262)) 10%,transparent);
font-weight:600;
}
[data-vibeui-dialog-013-window] [data-part="grade"] input{position:absolute;opacity:0;width:0;height:0}
[data-vibeui-dialog-013-window] [data-part="field"]{display:flex;flex-direction:column;gap:0.375rem;margin-top:1rem;font-size:0.8125rem;font-weight:500}
[data-vibeui-dialog-013-window] textarea{
width:100%;box-sizing:border-box;margin:0;min-height:5rem;padding:0.625rem 0.75rem;resize:vertical;
border:1px solid var(--vibeui-dialog-013-border,oklch(0.89 0.006 265));
border-radius:0.625rem;background:oklch(1 0 0);color:inherit;
font:inherit;font-size:0.875rem;line-height:1.5;
}
[data-vibeui-dialog-013-window] textarea:focus{
outline:none;border-color:var(--vibeui-dialog-013-accent,oklch(0.55 0.2 262));
box-shadow:0 0 0 3px color-mix(in oklab,var(--vibeui-dialog-013-accent,oklch(0.55 0.2 262)) 20%,transparent);
}
[data-vibeui-dialog-013-window] [data-part="actions"]{display:flex;justify-content:flex-end;gap:0.5rem;margin-top:1.125rem}
[data-vibeui-dialog-013-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;
}
[data-vibeui-dialog-013-window] [data-part="skip"]{background:transparent;color:var(--vibeui-dialog-013-muted,oklch(0.5 0.014 265));border-color:var(--vibeui-dialog-013-border,oklch(0.89 0.006 265))}
[data-vibeui-dialog-013-window] [data-part="submit"]{background:var(--vibeui-dialog-013-accent,oklch(0.55 0.2 262));color:oklch(1 0 0)}
[data-vibeui-dialog-013-window] [data-part="submit"]:hover{filter:brightness(0.94)}
[data-vibeui-dialog-013-window] :focus-visible{outline:2px solid var(--vibeui-dialog-013-accent,oklch(0.55 0.2 262));outline-offset:2px}
@media (prefers-reduced-motion:reduce){
[data-vibeui-block="dialog-013"] *{animation:none!important;transition:none!important}
[data-vibeui-dialog-013-window]{transition:none!important;opacity:1;transform:none}
}
`

const DEFAULT_SCALE = ["Мешало", "Терпимо", "Нормально", "Удобно", "Отлично"]

/**
 * Окно отзыва: оценка словами и необязательный комментарий.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Dialog013({
  id = "vibeui-dialog-013",
  trigger = "Оставить отзыв",
  title = "Как прошла сборка страницы?",
  description = "Ответ анонимный и занимает пару секунд. Он попадает прямо к тем, кто делает редактор.",
  scale = DEFAULT_SCALE,
  fieldLabel = "Что можно улучшить? Необязательно",
  placeholder = "Например: блок тарифов сложно двигать на телефоне",
  submitLabel = "Отправить",
  skipLabel = "Не сейчас",
  accent,
  className,
  style,
}: Dialog013Props) {
  const palette = {
    ...(accent ? { "--vibeui-dialog-013-accent": accent } : null),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-dialog-013" precedence="medium">
        {STYLES}
      </style>
      <div data-vibeui-block="dialog-013" className={className} style={palette}>
        <button data-part="trigger" type="button" popoverTarget={id}>
          {trigger}
        </button>
        <div
          id={id}
          popover="auto"
          data-vibeui-dialog-013-window=""
          role="dialog"
          aria-labelledby={`${id}-title`}
          style={palette}
        >
          <h2 data-part="title" id={`${id}-title`}>
            {title}
          </h2>
          {description ? <p data-part="description">{description}</p> : null}
          <form method="dialog">
            <div data-part="scale" role="group" aria-label="Оценка">
              {scale.map((grade, index) => (
                <label key={grade} data-part="grade">
                  <input
                    type="radio"
                    name={`${id}-grade`}
                    value={index + 1}
                    defaultChecked={index === scale.length - 2}
                  />
                  {grade}
                </label>
              ))}
            </div>
            <label data-part="field">
              {fieldLabel}
              <textarea name="comment" placeholder={placeholder} />
            </label>
            <div data-part="actions">
              <button data-part="skip" type="button" popoverTarget={id}>
                {skipLabel}
              </button>
              <button data-part="submit" type="submit" popoverTarget={id}>
                {submitLabel}
              </button>
            </div>
          </form>
        </div>
      </div>
    </>
  )
}