Feedback

Field Hint

A field hint tied to focus rather than hover: password rules are needed while typing, and the mouse pointer has nothing to do with that moment.

  • tooltip
  • form
  • focus
  • hint

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-007?lang=en

At least 12 characters, one digit and one symbol. Spaces count.

Подсказка появляется, когда поле получает фокус.

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-007" (Field Hint) 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-007.json

Registry item: https://vibeui.ru/r/tooltip-007.json
Installs to: components/vibeui/tooltip-007.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 field hint tied to focus rather than hover: password rules are needed while typing, and the mouse pointer has nothing to do with that moment.

A field hint that opens on focus: the rules appear while typing. Zero dependencies, one file, no client JS.

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

<Tooltip007
  label="New password"
  hint="At least 12 characters and one digit."
  name="password"
/>

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-007-* palette — do not swap it for your theme tokens
- opening on focus rather than hover: the rules are needed while typing
- aria-describedby on the field — the hint must be read together with it
- the absolute positioning of the hint: its appearance must not shift the form
- the visible focus ring on the field — it stays the only marker of where you are typing
- the card's own light surface: without it the dark text disappears on a dark background

## 6. You may change
- the field caption through label and the rules through hint
- the placeholder through placeholder and the field name through name
- the input type if the rules are not about a password
- the hint colour through the --vibeui-tooltip-007-tip variable

## 7. Rules
- The hint validates nothing: the form does the checking, the component only states the rules.
- The ids are literal strings — with two fields on a page they have to be made unique.
- The hint covers whatever sits below the field: leave some vertical room under it.
- 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-007.json
https://vibeui.ru/r/tooltip-007.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-tooltip-007-*. Серверный: подсказка раскрывается правилом :focus-within у обёртки поля, поэтому обработчики не нужны. Она объявлена aria-describedby у input и помечена role="note", то есть читается вслух вместе с полем. Подсказка выведена из потока абсолютным позиционированием: появление не сдвигает форму. Обёртка растянута на ширину поля, поэтому подсказка совпадает с ним по краям.

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 Tooltip007Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children"
> & {
  label?: string
  /** Требование к вводу: показывается, пока поле в фокусе. */
  hint?: string
  placeholder?: string
  name?: string
}

// Идея компонента: подсказка у поля ввода, привязанная к фокусу, а не к
// наведению. Требования к паролю или формату нужны ровно в момент набора,
// поэтому :focus-within открывает их, а курсор мыши ничего не показывает.
const STYLES = `
:where([data-vibeui-block="tooltip-007"]){
--vibeui-tooltip-007-bg:oklch(1 0 0);
--vibeui-tooltip-007-fg:oklch(0.24 0.014 265);
--vibeui-tooltip-007-muted:oklch(0.54 0.014 265);
--vibeui-tooltip-007-border:oklch(0.88 0.006 265);
--vibeui-tooltip-007-tip:oklch(0.97 0.02 250);
--vibeui-tooltip-007-tipfg:oklch(0.35 0.07 250);
--vibeui-tooltip-007-accent:oklch(0.56 0.17 260);
--vibeui-tooltip-007-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="tooltip-007"]{
position:relative;
display:flex;flex-direction:column;gap:0.375rem;
width:100%;max-width:20rem;box-sizing:border-box;
padding:1rem;
border:1px solid var(--vibeui-tooltip-007-border);border-radius:0.875rem;
background:var(--vibeui-tooltip-007-bg);color:var(--vibeui-tooltip-007-fg);
font-family:var(--vibeui-tooltip-007-font);
}
[data-vibeui-block="tooltip-007"] [data-part="label"]{font-size:0.8125rem;font-weight:620}
[data-vibeui-block="tooltip-007"] [data-part="field"]{position:relative;display:flex}
[data-vibeui-block="tooltip-007"] [data-part="input"]{
width:100%;box-sizing:border-box;
height:2.375rem;padding:0 0.6875rem;border-radius:0.625rem;
border:1px solid var(--vibeui-tooltip-007-border);
background:oklch(0.99 0.002 265);color:inherit;
font:inherit;font-size:0.875rem;
transition:border-color .16s ease,box-shadow .16s ease;
}
[data-vibeui-block="tooltip-007"] [data-part="input"]::placeholder{color:oklch(0.68 0.01 265)}
[data-vibeui-block="tooltip-007"] [data-part="input"]:focus{
outline:none;border-color:var(--vibeui-tooltip-007-accent);
box-shadow:0 0 0 3px color-mix(in oklab,var(--vibeui-tooltip-007-accent) 22%,transparent);
}
/* Подсказка открывается фокусом, а не курсором: она нужна во время набора. */
[data-vibeui-block="tooltip-007"] [data-part="hint"]{
position:absolute;left:0;right:0;top:calc(100% + 0.4375rem);z-index:20;
box-sizing:border-box;padding:0.5rem 0.625rem;border-radius:0.5rem;
background:var(--vibeui-tooltip-007-tip);color:var(--vibeui-tooltip-007-tipfg);
font-size:0.75rem;line-height:1.45;
opacity:0;visibility:hidden;translate:0 -0.25rem;
transition:opacity .14s ease,translate .14s ease,visibility .14s;
}
[data-vibeui-block="tooltip-007"] [data-part="hint"]::before{
content:"";position:absolute;left:0.9375rem;top:-0.1875rem;
width:0.5rem;height:0.5rem;background:inherit;transform:rotate(45deg);
}
[data-vibeui-block="tooltip-007"] [data-part="field"]:focus-within [data-part="hint"]{
opacity:1;visibility:visible;translate:0 0;
}
[data-vibeui-block="tooltip-007"] [data-part="foot"]{
margin:0;font-size:0.75rem;line-height:1.45;color:var(--vibeui-tooltip-007-muted);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="tooltip-007"] *{animation:none!important;transition:none!important}}
`

/**
 * Подсказка у поля ввода, которая открывается фокусом, а не наведением.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Tooltip007({
  label = "Новый пароль",
  hint = "От 12 знаков, хотя бы одна цифра и один спецсимвол. Пробелы считаются.",
  placeholder = "••••••••••••",
  name = "password",
  className,
  style,
  ...props
}: Tooltip007Props) {
  return (
    <>
      <style href="vibeui-tooltip-007" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="tooltip-007"
        className={className}
        style={style as CSSProperties}
      >
        <label data-part="label" htmlFor="vibeui-tooltip-007-input">
          {label}
        </label>
        <span data-part="field">
          <input
            data-part="input"
            id="vibeui-tooltip-007-input"
            name={name}
            type="password"
            placeholder={placeholder}
            aria-describedby="vibeui-tooltip-007-hint"
          />
          <span data-part="hint" id="vibeui-tooltip-007-hint" role="note">
            {hint}
          </span>
        </span>
        <p data-part="foot">Подсказка появляется, когда поле получает фокус.</p>
      </div>
    </>
  )
}