Feedback

Icon Toolbar

A toolbar of icons where the tooltip is the only caption: every button carries its own accessible name and the visible tip belongs to its cell.

  • tooltip
  • toolbar
  • icon
  • label

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-004?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 "tooltip-004" (Icon Toolbar) 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-004.json

Registry item: https://vibeui.ru/r/tooltip-004.json
Installs to: components/vibeui/tooltip-004.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 toolbar of icons where the tooltip is the only caption: every button carries its own accessible name and the visible tip belongs to its cell.

A toolbar of icon buttons with tooltips instead of captions. Zero dependencies, one file, no client JS.

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

<Tooltip004
  side="top"
  actions={[{ glyph: "↩", label: "Undo" }]}
/>

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-004-* palette — do not swap it for your theme tokens
- binding the tooltip to the cell rather than the toolbar: otherwise hovering opens every tip at once
- the aria-label on each button — an unnamed icon is never read aloud
- aria-hidden on the visible tooltip: otherwise the button name is announced twice
- role="toolbar" on the panel — that is how a group of buttons is announced as one
- the toolbar's own light surface: without it the dark glyphs disappear on a dark background

## 6. You may change
- the toolbar contents through actions — a glyph and a caption per button
- the side the tips appear on through side — top or bottom
- the button size through width and height in the button rule
- the tooltip colour through the --vibeui-tooltip-004-tip variable

## 7. Rules
- The glyphs are characters: your own icon replaces the content of glyph.
- The divider is drawn before the last button; a different grouping needs the rule rewritten.
- On a phone the tooltips never appear — duplicate important actions with a caption elsewhere.
- 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-004.json
https://vibeui.ru/r/tooltip-004.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-tooltip-004-*. Серверный: открытие держится на :hover и :focus-within, но не у панели, а у ячейки — иначе наведение на панель раскрыло бы все подсказки разом. Панель объявлена role="toolbar", у каждой кнопки есть aria-label, а видимая подсказка помечена aria-hidden, чтобы имя не читалось дважды. Сторона всплытия переключается пропом side.

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 Tooltip004Action = { glyph: string; label: string }

export type Tooltip004Props = Omit<
  ComponentPropsWithoutRef<"div">,
  "children"
> & {
  actions?: Tooltip004Action[]
  /** С какой стороны панели всплывают подсказки. */
  side?: "top" | "bottom"
}

// Идея компонента: панель иконок, где подсказка — не украшение, а единственная
// подпись. Каждая кнопка несёт aria-label, а видимая подсказка привязана
// к своей ячейке, поэтому соседние подсказки не перекрывают друг друга.
const STYLES = `
:where([data-vibeui-block="tooltip-004"]){
--vibeui-tooltip-004-bg:oklch(1 0 0);
--vibeui-tooltip-004-fg:oklch(0.26 0.014 265);
--vibeui-tooltip-004-border:oklch(0.9 0.006 265);
--vibeui-tooltip-004-hover:oklch(0.95 0.004 265);
--vibeui-tooltip-004-tip:oklch(0.24 0.014 265);
--vibeui-tooltip-004-accent:oklch(0.57 0.17 265);
--vibeui-tooltip-004-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="tooltip-004"]{
display:inline-flex;align-items:center;gap:0.125rem;
padding:0.3125rem;box-sizing:border-box;
border:1px solid var(--vibeui-tooltip-004-border);border-radius:0.875rem;
background:var(--vibeui-tooltip-004-bg);color:var(--vibeui-tooltip-004-fg);
font-family:var(--vibeui-tooltip-004-font);
box-shadow:0 14px 30px -24px oklch(0.2 0.02 265 / 55%);
}
/* Подсказка привязана к своей ячейке: соседние не перекрываются. */
[data-vibeui-block="tooltip-004"] [data-part="item"]{position:relative;display:inline-flex}
[data-vibeui-block="tooltip-004"] [data-part="button"]{
appearance:none;cursor:pointer;border:0;background:transparent;
display:inline-flex;align-items:center;justify-content:center;
width:2.125rem;height:2.125rem;border-radius:0.625rem;
color:inherit;font:inherit;font-size:0.9375rem;line-height:1;
transition:background-color .14s ease;
}
[data-vibeui-block="tooltip-004"] [data-part="button"]:hover{background:var(--vibeui-tooltip-004-hover)}
[data-vibeui-block="tooltip-004"] [data-part="button"]:focus-visible{outline:2px solid var(--vibeui-tooltip-004-accent);outline-offset:2px}
[data-vibeui-block="tooltip-004"] [data-part="divider"]{
width:1px;height:1.25rem;margin:0 0.25rem;background:var(--vibeui-tooltip-004-border);
}
[data-vibeui-block="tooltip-004"] [data-part="tip"]{
position:absolute;left:50%;z-index:30;
width:max-content;max-width:12rem;
padding:0.3125rem 0.5rem;border-radius:0.4375rem;
background:var(--vibeui-tooltip-004-tip);color:oklch(0.98 0.002 265);
font-size:0.6875rem;font-weight:560;line-height:1.35;text-align:center;
pointer-events:none;opacity:0;
transform:translate(-50%,0.1875rem);
transition:opacity .12s ease,transform .12s ease;
}
[data-vibeui-block="tooltip-004"][data-side="top"] [data-part="tip"]{bottom:calc(100% + 0.5rem)}
[data-vibeui-block="tooltip-004"][data-side="bottom"] [data-part="tip"]{top:calc(100% + 0.5rem);transform:translate(-50%,-0.1875rem)}
[data-vibeui-block="tooltip-004"] [data-part="item"]:hover [data-part="tip"],
[data-vibeui-block="tooltip-004"] [data-part="item"]:focus-within [data-part="tip"]{opacity:1;transform:translate(-50%,0)}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="tooltip-004"] *{animation:none!important;transition:none!important}}
`

const DEFAULT_ACTIONS: Tooltip004Action[] = [
  { glyph: "↩", label: "Отменить действие" },
  { glyph: "↪", label: "Вернуть действие" },
  { glyph: "⧉", label: "Дублировать слой" },
  { glyph: "🗑", label: "Удалить слой" },
]

/**
 * Панель иконок-кнопок, где подсказка служит единственной подписью.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Tooltip004({
  actions = DEFAULT_ACTIONS,
  side = "top",
  className,
  style,
  ...props
}: Tooltip004Props) {
  return (
    <>
      <style href="vibeui-tooltip-004" precedence="medium">
        {STYLES}
      </style>
      <div
        {...props}
        data-vibeui-block="tooltip-004"
        data-side={side}
        role="toolbar"
        aria-label="Действия над слоем"
        className={className}
        style={style as CSSProperties}
      >
        {actions.map((action, index) => (
          <span data-part="item" key={action.label}>
            {index === actions.length - 1 ? (
              <span data-part="divider" aria-hidden="true" />
            ) : null}
            <button data-part="button" type="button" aria-label={action.label}>
              <span aria-hidden="true">{action.glyph}</span>
            </button>
            <span data-part="tip" aria-hidden="true">
              {action.label}
            </span>
          </span>
        ))}
      </div>
    </>
  )
}