Feedback

Message Toast

A toast about a personal message rather than a system event: initials tinted from the name, two lines of text and a quick reply field.

  • toast
  • message
  • avatar
  • reply

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/toast-009?lang=en

Artem Severov18:04

Посмотри последний макет каталога — там поменялась сетка карточек, хочу услышать твоё мнение до вечера.

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 "toast-009" (Message Toast) 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/toast-009.json

Registry item: https://vibeui.ru/r/toast-009.json
Installs to: components/vibeui/toast-009.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 toast about a personal message rather than a system event: initials tinted from the name, two lines of text and a quick reply field.

A direct-message toast: initials coloured from the name, the text and a quick reply button. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Toast009 } from "@/components/vibeui/toast-009"

<Toast009
  name="Artem Severov"
  message="Take a look at the latest catalog mockup"
  time="18:04"
  replyLabel="Reply…"
/>

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-toast-009-* palette — do not swap it for your theme tokens
- deriving the hue from the name: a colour dictionary has to be maintained by hand and drifts
- the reply field as a button, not an input: a real form inside a short-lived toast needs a focus trap
- the sender name in the button label — a bare "Reply" is useless in a stream
- the two-line clamp on the message: a long letter is read in the thread, not in a toast
- the card's own light surface: without it the dark text disappears on a dark background

## 6. You may change
- the sender through name and the copy through message
- the timestamp through time
- the quick reply caption through replyLabel
- the radius and surface through --vibeui-toast-009-radius and --vibeui-toast-009-bg

## 7. Rules
- Initials come from the first two words of the name: a single-word handle gives one letter.
- The hue is stable for one name, but two different names may collide — that is acceptable.
- Tapping the reply field only calls onReply: opening the thread is the caller's job.
- 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/toast-009.json
https://vibeui.ru/r/toast-009.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-toast-009-*. Серверный: хуков нет. Оттенок кружка выводится из имени хешем FNV-1a и кладётся в --vibeui-toast-009-hue, поэтому у каждого собеседника свой цвет без словаря соответствий. Поле ответа — это кнопка, стилизованная под ввод: настоящая форма в уведомлении требует фокус-ловушки, а уведомление живёт несколько секунд. Текст обрезан на двух строках.

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 Toast009Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children" | "title"
> & {
  name?: string
  /** Текст сообщения: одна-две строки, дальше — в переписку. */
  message?: string
  time?: string
  replyLabel?: string
  onReply?: () => void
}

// Идея компонента: уведомление о сообщении, а не о системном событии. Слева
// кружок с инициалами, цвет которого выводится из имени, поэтому у каждого
// собеседника свой оттенок и в потоке они не сливаются.
const STYLES = `
:where([data-vibeui-block="toast-009"]){
--vibeui-toast-009-bg:oklch(1 0 0);
--vibeui-toast-009-fg:oklch(0.23 0.014 265);
--vibeui-toast-009-muted:oklch(0.55 0.014 265);
--vibeui-toast-009-border:oklch(0.9 0.006 265);
--vibeui-toast-009-hue:250;
--vibeui-toast-009-radius:1.125rem;
--vibeui-toast-009-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="toast-009"]{
display:flex;gap:0.6875rem;align-items:flex-start;
width:100%;max-width:23rem;box-sizing:border-box;
padding:0.75rem 0.875rem;
border:1px solid var(--vibeui-toast-009-border);
border-radius:var(--vibeui-toast-009-radius);
background:var(--vibeui-toast-009-bg);color:var(--vibeui-toast-009-fg);
font-family:var(--vibeui-toast-009-font);
box-shadow:0 20px 42px -28px oklch(0.2 0.02 265 / 50%);
}
/* Оттенок кружка выводится из имени: два собеседника не совпадут случайно. */
[data-vibeui-block="toast-009"] [data-part="face"]{
flex:none;display:flex;align-items:center;justify-content:center;
width:2.375rem;height:2.375rem;border-radius:9999px;
background:oklch(0.91 0.06 var(--vibeui-toast-009-hue));
color:oklch(0.36 0.1 var(--vibeui-toast-009-hue));
font-size:0.8125rem;font-weight:700;letter-spacing:0.02em;
}
[data-vibeui-block="toast-009"] [data-part="body"]{display:flex;flex-direction:column;gap:0.125rem;min-width:0;flex:1 1 auto}
[data-vibeui-block="toast-009"] [data-part="head"]{display:flex;align-items:baseline;gap:0.5rem}
[data-vibeui-block="toast-009"] [data-part="name"]{font-size:0.875rem;font-weight:650;line-height:1.3;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
[data-vibeui-block="toast-009"] [data-part="time"]{flex:none;margin-left:auto;font-size:0.75rem;color:var(--vibeui-toast-009-muted);font-variant-numeric:tabular-nums}
[data-vibeui-block="toast-009"] [data-part="message"]{
margin:0;font-size:0.8125rem;line-height:1.45;color:var(--vibeui-toast-009-muted);
display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;
}
/* Поле ответа — не настоящее: уведомление отдаёт клик, а не форму. */
[data-vibeui-block="toast-009"] [data-part="reply"]{
appearance:none;cursor:pointer;text-align:left;
margin-top:0.5rem;width:100%;box-sizing:border-box;
padding:0.4375rem 0.6875rem;border-radius:9999px;
border:1px solid var(--vibeui-toast-009-border);background:oklch(0.97 0.004 265);
font:inherit;font-size:0.8125rem;color:var(--vibeui-toast-009-muted);
transition:border-color .16s ease,background-color .16s ease,color .16s ease;
}
[data-vibeui-block="toast-009"] [data-part="reply"]:hover{
background:oklch(1 0 0);color:var(--vibeui-toast-009-fg);
border-color:oklch(0.72 0.06 var(--vibeui-toast-009-hue));
}
[data-vibeui-block="toast-009"] [data-part="reply"]:focus-visible{outline:2px solid oklch(0.6 0.14 var(--vibeui-toast-009-hue));outline-offset:2px}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="toast-009"] *{animation:none!important;transition:none!important}}
`

function hue(name: string) {
  let hash = 2166136261

  for (const symbol of name) {
    hash ^= symbol.codePointAt(0)!
    hash = Math.imul(hash, 16777619)
  }

  return ((hash >>> 0) % 12) * 30
}

function initials(name: string) {
  return name
    .split(" ")
    .slice(0, 2)
    .map((part) => part[0]?.toUpperCase() ?? "")
    .join("")
}

/**
 * Уведомление о личном сообщении: инициалы, текст и быстрый ответ.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Toast009({
  name = "Артём Северов",
  message = "Посмотри последний макет каталога — там поменялась сетка карточек, хочу услышать твоё мнение до вечера.",
  time = "18:04",
  replyLabel = "Ответить…",
  onReply,
  className,
  style,
  ...props
}: Toast009Props) {
  const palette = {
    "--vibeui-toast-009-hue": hue(name),
    ...style,
  } as CSSProperties

  return (
    <>
      <style href="vibeui-toast-009" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="toast-009"
        role="status"
        aria-live="polite"
        className={className}
        style={palette}
      >
        <span data-part="face" aria-hidden="true">
          {initials(name)}
        </span>
        <div data-part="body">
          <span data-part="head">
            <span data-part="name">{name}</span>
            <span data-part="time">{time}</span>
          </span>
          <p data-part="message">{message}</p>
          {replyLabel ? (
            <button
              data-part="reply"
              type="button"
              onClick={onReply}
              aria-label={`Ответить: ${name}`}
            >
              {replyLabel}
            </button>
          ) : null}
        </div>
      </div>
    </>
  )
}