Feedback

Native Versus

A side-by-side comparison: a button with the native title on the left, a custom tooltip on the right — arrowed, instant and reachable from the keyboard.

  • tooltip
  • comparison
  • accessibility
  • native

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/tooltip-002?lang=en

задержка ~1 с, стиль системы

Copy link

сразу, со стрелкой, по фокусу

Нативная подсказка не появляется по Tab и не читается на телефоне. Своя открывается и по наведению, и по фокусу — и выглядит одинаково во всех системах.

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 "tooltip-002" (Native Versus) 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/tooltip-002.json

Registry item: https://vibeui.ru/r/tooltip-002.json
Installs to: components/vibeui/tooltip-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 side-by-side comparison: a button with the native title on the left, a custom tooltip on the right — arrowed, instant and reachable from the keyboard.

A demonstration of the difference between the title attribute and a custom tooltip. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Tooltip002 } from "@/components/vibeui/tooltip-002"

<Tooltip002
  tip="Copy link"
  nativeLabel="Native title"
  customLabel="Custom tooltip"
/>

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-tooltip-002-* palette — do not swap it for your theme tokens
- the native cell untouched: it is supposed to behave like a system tooltip
- opening the custom tooltip on :focus-within — without it half the users never see it
- aria-describedby on the right button: a visible tooltip must be tied to its element
- the arrow made of a rotated square with background:inherit — it survives a colour change
- the card's own light surface: without it the dark text disappears on a dark background

## 6. You may change
- the text of both tooltips through tip
- the button captions through nativeLabel and customLabel
- the explanatory captions under the buttons
- the tooltip colour through the --vibeui-tooltip-002-tip variable

## 7. Rules
- On a phone the native cell shows nothing: that is part of the demonstration, not a bug.
- The system tooltip delay is set by the operating system and cannot be changed from CSS.
- Both tooltips show the same text on purpose — the mechanics are compared, not the wording.
- 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/tooltip-002.json
https://vibeui.ru/r/tooltip-002.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-tooltip-002-*. Серверный: обе подсказки держатся на :hover и :focus-within, JS не нужен. Левая ячейка намеренно оставлена нативной — атрибут title показывает системную подсказку через секунду с лишним, без стрелки и без реакции на Tab. Правая собрана вручную: хвостик — повёрнутый квадрат того же цвета, открытие продублировано фокусом, связь с кнопкой объявлена через aria-describedby.

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 Tooltip002Props = Omit<ComponentPropsWithoutRef<"div">, "title"> & {
  /** Текст, который показывают обе подсказки: разница только в механике. */
  tip?: string
  nativeLabel?: string
  customLabel?: string
}

// Идея компонента: наглядное сравнение. Слева кнопка с атрибутом title —
// подсказка появляется через секунду с лишним, в системном стиле, без стрелки
// и не читается с клавиатуры. Справа своя: мгновенная, со стрелкой, по фокусу.
const STYLES = `
:where([data-vibeui-block="tooltip-002"]){
--vibeui-tooltip-002-bg:oklch(1 0 0);
--vibeui-tooltip-002-fg:oklch(0.24 0.014 265);
--vibeui-tooltip-002-muted:oklch(0.55 0.014 265);
--vibeui-tooltip-002-border:oklch(0.9 0.006 265);
--vibeui-tooltip-002-tip:oklch(0.26 0.014 265);
--vibeui-tooltip-002-accent:oklch(0.57 0.17 265);
--vibeui-tooltip-002-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="tooltip-002"]{
display:grid;grid-template-columns:1fr 1fr;gap:0.75rem;
width:100%;max-width:26rem;box-sizing:border-box;
padding:1.125rem;
border:1px solid var(--vibeui-tooltip-002-border);border-radius:1rem;
background:var(--vibeui-tooltip-002-bg);color:var(--vibeui-tooltip-002-fg);
font-family:var(--vibeui-tooltip-002-font);
}
[data-vibeui-block="tooltip-002"] [data-part="cell"]{
display:flex;flex-direction:column;align-items:center;gap:0.5rem;
padding:1.25rem 0.75rem 0.875rem;box-sizing:border-box;
border:1px dashed var(--vibeui-tooltip-002-border);border-radius:0.875rem;
text-align:center;
}
[data-vibeui-block="tooltip-002"] [data-part="caption"]{
margin:0;font-size:0.6875rem;line-height:1.4;letter-spacing:0.03em;
text-transform:uppercase;color:var(--vibeui-tooltip-002-muted);
}
[data-vibeui-block="tooltip-002"] [data-part="button"]{
appearance:none;cursor:pointer;
height:2.25rem;padding:0 0.875rem;border-radius:0.625rem;
border:1px solid var(--vibeui-tooltip-002-border);
background:oklch(0.98 0.003 265);color:inherit;
font:inherit;font-size:0.8125rem;font-weight:620;
}
[data-vibeui-block="tooltip-002"] [data-part="button"]:focus-visible{outline:2px solid var(--vibeui-tooltip-002-accent);outline-offset:2px}
/* Своя подсказка: мгновенная, со стрелкой, открывается и по фокусу. */
[data-vibeui-block="tooltip-002"] [data-part="own"]{position:relative;display:inline-flex}
[data-vibeui-block="tooltip-002"] [data-part="tip"]{
position:absolute;bottom:calc(100% + 0.5rem);left:50%;z-index:20;
width:max-content;max-width:11rem;
padding:0.375rem 0.5625rem;border-radius:0.4375rem;
background:var(--vibeui-tooltip-002-tip);color:oklch(0.98 0.002 265);
font-size:0.75rem;line-height:1.4;
pointer-events:none;opacity:0;
transform:translate(-50%,0.25rem);
transition:opacity .12s ease,transform .12s ease;
}
[data-vibeui-block="tooltip-002"] [data-part="tip"]::after{
content:"";position:absolute;left:50%;bottom:-0.1875rem;
width:0.5rem;height:0.5rem;margin-left:-0.25rem;
background:inherit;transform:rotate(45deg);
}
[data-vibeui-block="tooltip-002"] [data-part="own"]:hover [data-part="tip"],
[data-vibeui-block="tooltip-002"] [data-part="own"]:focus-within [data-part="tip"]{
opacity:1;transform:translate(-50%,0);
}
[data-vibeui-block="tooltip-002"] [data-part="note"]{
grid-column:1 / -1;margin:0;
font-size:0.75rem;line-height:1.5;color:var(--vibeui-tooltip-002-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="tooltip-002"] *{animation:none!important;transition:none!important}}
`

/**
 * Сравнение нативного title и собственной подсказки на одном экране.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Tooltip002({
  tip = "Скопировать ссылку",
  nativeLabel = "Нативный title",
  customLabel = "Своя подсказка",
  className,
  style,
  ...props
}: Tooltip002Props) {
  return (
    <>
      <style href="vibeui-tooltip-002" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="tooltip-002"
        className={className}
        style={style as CSSProperties}
      >
        <div data-part="cell">
          <button data-part="button" type="button" title={tip}>
            {nativeLabel}
          </button>
          <p data-part="caption">задержка ~1 с, стиль системы</p>
        </div>
        <div data-part="cell">
          <span data-part="own">
            <button
              data-part="button"
              type="button"
              aria-describedby="vibeui-tooltip-002-tip"
            >
              {customLabel}
            </button>
            <span data-part="tip" role="tooltip" id="vibeui-tooltip-002-tip">
              {tip}
            </span>
          </span>
          <p data-part="caption">сразу, со стрелкой, по фокусу</p>
        </div>
        <p data-part="note">
          Нативная подсказка не появляется по Tab и не читается на телефоне.
          Своя открывается и по наведению, и по фокусу — и выглядит одинаково во
          всех системах.
        </p>
      </div>
    </>
  )
}