Feedback
Info Popover
A popover card on the HTML popover: you can reach it with the mouse and Tab, so it never closes on mouse-out.
- popover
- explain
- no-js
- anchor
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/popover-001?lang=en
How reach is measured
Берём уникальных посетителей за семь дней и вычитаем ботов по списку известных агентов.
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 "popover-001" (Info Popover) 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/popover-001.json
Registry item: https://vibeui.ru/r/popover-001.json
Installs to: components/vibeui/popover-001.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 popover card on the HTML popover: you can reach it with the mouse and Tab, so it never closes on mouse-out.
A click-opened explanation card: heading, text and an action inside, closing on Escape and outside click. Zero dependencies, one file, no client JS.
## 3. How to use it
import { Popover001 } from "@/components/vibeui/popover-001"
<Popover001 label="What this means" title="How reach is measured" />
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-popover-001-* palette — do not swap it for your theme tokens
- opening on click rather than hover: a card with a button must be reachable
- popover instead of custom state: Escape, outside click and the top layer come free
- the @supports fallback for browsers without anchor positioning
- the width cap: an explanation wider than 18rem reads badly
- the aria-label on the card — it has a name, not just text
## 6. You may change
- label, title and text
- actionLabel — the action inside
- the accent through the accent prop
- the card width
## 7. Rules
- For a short icon caption use a tooltip (tooltip-001), not this card.
- Do not put a form inside: a popup with fields belongs in a dialog.
- The card does not flip near the viewport edge: add position-try if you need that.
- 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/popover-001.jsonhttps://vibeui.ru/r/popover-001.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-popover-001-*. Серверный компонент: открытие и закрытие держит HTML popover, позиция — anchor positioning с запасным правилом в @supports. Внутри карточки живут заголовок, текст и кнопка, поэтому нужен именно popover, а не подсказка.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import { useId } from "react"
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Popover001Props = Omit<
ComponentPropsWithoutRef<"div">,
"children" | "title"
> & {
label?: string
title?: string
text?: string
actionLabel?: string
accent?: string
}
// Идея компонента: всплывающая карточка с текстом и действием на HTML
// popover. Она отличается от подсказки тем, что в неё можно попасть мышью и
// с клавиатуры: внутри живут ссылки и кнопки. Поэтому она не закрывается по
// уходу курсора — только по Escape, клику вне или действию.
const STYLES = `
:where([data-vibeui-block="popover-001"]){
--vibeui-popover-001-bg:oklch(1 0 0);
--vibeui-popover-001-fg:oklch(0.24 0.014 265);
--vibeui-popover-001-muted:oklch(0.56 0.014 265);
--vibeui-popover-001-border:oklch(0.9 0.006 265);
--vibeui-popover-001-hover:oklch(0.96 0.004 265);
--vibeui-popover-001-accent:oklch(0.55 0.17 265);
--vibeui-popover-001-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="popover-001"]{
display:inline-block;font-family:var(--vibeui-popover-001-font);color:var(--vibeui-popover-001-fg);
}
[data-vibeui-block="popover-001"] [data-part="trigger"]{
appearance:none;cursor:pointer;
display:inline-flex;align-items:center;gap:0.375rem;
height:2.25rem;padding:0 0.875rem;
border:1px solid var(--vibeui-popover-001-border);border-radius:0.625rem;
background:var(--vibeui-popover-001-bg);color:inherit;
font:inherit;font-size:0.8125rem;font-weight:600;
anchor-name:--vibeui-popover-001-anchor;
}
[data-vibeui-block="popover-001"] [data-part="trigger"]:hover{background:var(--vibeui-popover-001-hover)}
[data-vibeui-block="popover-001"] [data-part="trigger"]:focus-visible{outline:2px solid var(--vibeui-popover-001-accent);outline-offset:2px}
/* Карточка на popover: слой, Escape и клик вне достаются от браузера. */
[data-vibeui-block="popover-001"] [popover]{
position:fixed;margin:0;padding:0.875rem;
width:min(18rem,100vw - 2rem);box-sizing:border-box;
border:1px solid var(--vibeui-popover-001-border);border-radius:0.875rem;
background:var(--vibeui-popover-001-bg);color:inherit;
box-shadow:0 20px 44px -24px oklch(0.2 0.02 265 / 55%);
position-anchor:--vibeui-popover-001-anchor;
top:anchor(bottom);left:anchor(left);margin-top:0.5rem;
}
@supports not (anchor-name: --a){
[data-vibeui-block="popover-001"]{position:relative}
[data-vibeui-block="popover-001"] [popover]{position:absolute;top:calc(100% + 0.5rem);left:0;inset:auto}
}
[data-vibeui-block="popover-001"] [data-part="title"]{margin:0 0 0.25rem;font-size:0.875rem;font-weight:650}
[data-vibeui-block="popover-001"] [data-part="text"]{margin:0 0 0.625rem;font-size:0.8125rem;line-height:1.45;color:var(--vibeui-popover-001-muted)}
[data-vibeui-block="popover-001"] [data-part="action"]{
appearance:none;cursor:pointer;
height:2rem;padding:0 0.75rem;border:0;border-radius:0.5rem;
background:var(--vibeui-popover-001-accent);color:oklch(0.99 0.01 265);
font:inherit;font-size:0.8125rem;font-weight:650;
}
[data-vibeui-block="popover-001"] [data-part="action"]:focus-visible{outline:2px solid var(--vibeui-popover-001-accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="popover-001"] *{animation:none!important;transition:none!important}}
`
/**
* Всплывающая карточка на HTML popover: внутрь можно попасть мышью и Tab.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Popover001({
label = "Что это значит",
title = "Как считается охват",
text = "Берём уникальных посетителей за семь дней и вычитаем ботов по списку известных агентов.",
actionLabel = "Открыть методику",
accent,
className,
style,
...props
}: Popover001Props) {
const id = useId().replace(/:/g, "")
const palette = {
...(accent ? { "--vibeui-popover-001-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-popover-001" precedence="medium">
{STYLES}
</style>
<div
{...props}
data-vibeui-block="popover-001"
className={className}
style={palette}
>
<button type="button" data-part="trigger" popoverTarget={`${id}-card`}>
{label}
</button>
<div id={`${id}-card`} popover="auto" aria-label={title}>
<h3 data-part="title">{title}</h3>
<p data-part="text">{text}</p>
<button type="button" data-part="action">
{actionLabel}
</button>
</div>
</div>
</>
)
}