MeDo

Generatore di Tooltip IA.

Descrivi il suggerimento che ti serve e MeDo genera l'intero comportamento — ritardi di apertura e chiusura, ribaltamento per allontanarsi dai bordi del viewport, una freccia che resta puntata sul trigger, attivazione con il focus da tastiera e il collegamento aria-describedby.

Tooltip
Tooltip

Il tooltip è il componente che un terzo dei tuoi utenti non vedrà mai

Il passaggio del mouse non esiste su uno schermo touch. Non c'è nessun gesto su telefono che significhi in modo affidabile "mostrami la descrizione senza attivare questo controllo", il che vuol dire che ogni tooltip è invisibile a una quota consistente del tuo traffico. Questo singolo fatto risolve la maggior parte delle discussioni di design sui tooltip prima che comincino: un tooltip può contenere soltanto informazioni di cui l'utente non ha bisogno. I requisiti di un campo, i messaggi di errore, le clausole sui prezzi e il significato di un pulsante con sola icona devono stare in un punto visibile o in un nome accessibile. Considera il tooltip come una rifinitura sopra un'interfaccia che già funziona senza di esso, e le domande sull'accessibilità si risolvono quasi da sole.

6 modelli

Modelli di Tooltip che puoi generare

Ogni modello è un prompt reale, non uno screenshot. Copialo in qualsiasi editor IA, oppure eseguilo in MeDo e ottieni codice React + Tailwind.

BasicLabel Hint

Dark Panel Hint on Hover and Focus

The default tooltip: one line of plain text, dark panel, arrow, delays in both directions. Reach for it when a control is already named and you only want to add a detail a mouse user might appreciate.

Create a tooltip component that wraps a single trigger child and renders a short plain-text hint on pointer enter and on focus-visible. Use a dark slate panel with 13px white text, 6px vertical and 10px horizontal padding, a 6px radius, a 240px max width and an 8px offset from the trigger, plus a 6px arrow aimed at the trigger. Open after a 300ms delay and close after 100ms so the pointer can cross the gap without the panel vanishing. Dismiss on Escape, on blur and on scroll. Give the panel role="tooltip" and link it to the trigger with aria-describedby only while it is open, rather than leaving hidden markup in the tree. Fade and translate 4px on entry, and drop the transition entirely under prefers-reduced-motion.

Prova in MeDo
Icon-onlyIcon Button

Tooltip as the Only Label a Control Has

When the icon is the whole button, the tooltip text is the accessible name — not a description. Getting that distinction wrong is why so many toolbars announce the same word twice.

Create a tooltip for an icon-only button where the tooltip text is the only name the control has. Put that string in aria-label on the button and do not also set aria-describedby, so the same words are not announced twice. The visible panel exists for sighted pointer users: dark surface, 12px text, a single line that does not wrap under 200px. Open on hover after a 400ms delay but open immediately on focus-visible, since a keyboard user has already committed to the control. Close on Escape, on blur and on pointer leave. Keep the button hit area at least 44px even when the glyph is 20px, and skip rendering the panel entirely when a coarse pointer is detected.

Prova in MeDo
CollisionAuto Flip

Edge-Aware Placement With a Tracking Arrow

Handles the case a fixed side always breaks: a trigger near the top of a scroll container or the right edge of the viewport. The arrow has to re-anchor after the flip or it points at nothing.

Create a tooltip with collision-aware placement: a preferred side prop of top, bottom, left or right, an explicit fallback order, and shifting along the cross axis when the panel would overflow the viewport or the nearest scrolling ancestor. Add a 6px arrow that re-anchors to the trigger centre after any flip or shift, clamped so it never slides past the panel corner radius. Recompute position on scroll and resize behind a requestAnimationFrame throttle, and close rather than reposition once the trigger leaves the visible area. Keep the aria-describedby relationship stable across repositioning so the description is not re-announced. Use role="tooltip" and plain text content with no interactive children.

Prova in MeDo
ToolbarGroup Skip

Shared Delay Across a Button Row

One provider, one timer. Once the first tooltip in a toolbar has opened, moving along the row should switch content instantly instead of making the user wait 300ms per button.

Create a tooltip provider that shares open state across a group of triggers in a toolbar. The first tooltip in the group waits the full 300ms open delay; while any tooltip in the group is open, moving to a sibling trigger swaps the content with no delay and no exit animation, so the panel appears to slide along the row. Leaving the group entirely closes after a 150ms grace period. Reuse a single positioned panel element rather than mounting one per trigger, and update its aria-describedby target as the active trigger changes. Escape closes the group and returns focus behaviour to normal. Under prefers-reduced-motion, replace the slide with an instant content swap.

Prova in MeDo
Multi-lineRich Hint

Two-Line Tooltip With a Keyboard Shortcut

A label line plus a monospace shortcut hint on the right. Still passive, still text-only — the moment you want a link in here, you want a popover instead.

Create a tooltip that renders a label line plus a secondary line, with an optional keyboard shortcut rendered as a small monospace chip aligned to the right of the label. Cap the panel at 260px, allow the description to wrap to two lines, and keep line-height at 1.4 so the two lines read as one block. Content stays non-interactive: no links, no buttons, no selectable code — if the user needs to click inside, use a popover. Announce the whole panel as one description via aria-describedby so the shortcut is read as part of the sentence rather than as a separate node. Open after 300ms, close after 100ms, dismiss on Escape and blur.

Prova in MeDo
OverflowTruncation

Tooltip Only When the Text Is Clipped

Table cells and file names truncate with an ellipsis; a tooltip that repeats already-visible text is noise. Measure the element and only attach the tooltip when scrollWidth exceeds clientWidth.

Create a conditional tooltip for truncated text: compare scrollWidth against clientWidth on the target element and only register hover and focus handlers when the text is actually clipped, so a fully visible cell never shows a tooltip repeating itself. Re-measure on resize and whenever the text content changes, using a ResizeObserver rather than a window listener. When active, show the full string in a dark panel capped at 320px with wrapping enabled, positioned below the cell to avoid covering the row header. Make the truncated element focusable with tabindex="0" only while the tooltip is registered, so keyboard users can reach it without collecting empty tab stops across the whole table.

Prova in MeDo

Come personalizzare il tuo Tooltip

Imposta separatamente i ritardi di apertura e chiusura

Un unico ritardo condiviso è sbagliato in entrambe le direzioni. Circa 300ms prima dell'apertura evitano che i tooltip lampeggino mentre il puntatore attraversa una barra degli strumenti, mentre un breve ritardo di chiusura di 100ms consente al puntatore di passare dal trigger al tooltip senza che il pannello svanisca a metà del movimento.

Chiedi il rilevamento delle collisioni, non un lato fisso

Un tooltip fissato in alto viene tagliato dal bordo superiore del viewport o dal bordo di un contenitore scorrevole. Specifica un lato preferito più delle alternative così che il componente si ribalti e si sposti da solo, e indica che la freccia deve restare puntata sul trigger dopo lo spostamento.

Richiedi che lo attivi il focus, non solo il mouse

Se il tooltip risponde solo al mouse, chi usa la tastiera non ottiene nulla. Chiedi che si apra su focus-visible e si chiuda con Escape e blur: è anche ciò che lo rende usabile per chi naviga con un dispositivo a interruttore o uno screen reader.

Mantieni il contenuto passivo e solo testuale

Nel momento in cui un tooltip contiene un link, un pulsante o testo copiabile, serve un modo per raggiungerlo e tenerlo aperto, e smette di essere un tooltip. Specifica che il contenuto è testo semplice e non interattivo, e passa a un popover quando ti serve qualcosa di cliccabile all'interno.

Chi usa il componente Tooltip

Dashboard o strumento di amministrazione

Pulsanti della barra strumenti con sola icona che portano un vero nome accessibile più un tooltip che ripete l'etichetta per gli utenti vedenti con mouse, con il ritardo di apertura saltato quando il puntatore si muove tra pulsanti adiacenti.

Prodotto SaaS

Un suggerimento sulla legenda di un grafico che spiega come viene calcolata una metrica, che si ribalta sotto il trigger vicino alla parte superiore del pannello e si chiude allo scroll così da non fluttuare mai staccato dal punto che descrive.

Negozio e-commerce

Abbreviazioni della tabella taglie e icone dei badge di spedizione annotate al passaggio del mouse, con la stessa informazione ripetuta nel testo visibile della pagina prodotto perché chi acquista da telefono non attiverà mai il passaggio del mouse.

Documentazione per sviluppatori

Token di codice inline e abbreviazioni che rivelano una firma di tipo su una riga al passaggio o al focus, limitati a una larghezza massima ridotta perché il pannello non copra mai l'esempio di codice che sta spiegando.

Pattern di Tooltip per siti web diversi

Lo stesso componente tooltip, calibrato sul tipo di sito su cui viene pubblicato.

01 / 06

Dashboard and Admin Tools

Dense toolbars are where tooltips earn their keep and where a per-trigger delay is most annoying. Use one shared provider so moving along a row of icon buttons swaps the label instantly. The tooltip still cannot be the only place the label exists — every icon button needs a real accessible name regardless.

Stili e varianti di Tooltip

Scegli la variante che si adatta al resto della pagina, poi generala.

01 / 06

Dark Panel Tooltip

A dark slate surface with white text is the default for a reason: it reads as an overlay rather than as page content, so users do not mistake it for a permanent part of the layout. Keep the panel opaque — a translucent tooltip over a chart becomes unreadable exactly where it is needed.

Tooltip in React, Next.js, Vue e Svelte

React, Next.js, Vue 3, SvelteKit, Astro o HTML puro: lo stesso tooltip, sei modi per integrarlo.

01 / 06

React Tooltip

Positioning needs real DOM measurement, so this is a client component with refs on both trigger and panel. Portal the panel to document.body — a tooltip inside a container with overflow: hidden will be clipped no matter how correct the coordinates are.

src/components/Tooltip.tsx

export function Tooltip({ label, children }) {
  const [open, setOpen] = useState(false)
  const id = useId()

  return (
    <span
      onPointerEnter={() => setOpen(true)}
      onPointerLeave={() => setOpen(false)}
    >
      {cloneElement(children, { 'aria-describedby': open ? id : undefined })}
      {open && createPortal(<Panel id={id}>{label}</Panel>, document.body)}
    </span>
  )
}

Come aggiungere il tuo Tooltip a un progetto

Quattro passaggi, dalla scelta di un modello di tooltip alla messa in produzione.

01~30s

Pick a Tooltip Pattern

Choose by what the trigger already tells the user: a label hint for a named control, the icon-only variant when the tooltip text is the accessible name, or the truncation variant for table cells.

02~10s

Copy the Prompt

Take it into MeDo, Lovable, Bolt, v0 or Cursor, and set the open and close delays before you run it. Those two numbers are what separates a helpful hint from a panel that flickers across a toolbar.

03~1min

Generate and Refine

You get React + Tailwind back with a live preview. Follow up in plain English — "flip below near the top edge", "open instantly on focus", "skip the delay between toolbar buttons" — rather than editing coordinate math by hand.

04~2min

Wire the Triggers and Test the Keyboard

Portal the panel out of any overflow-hidden ancestor, then tab to each trigger and press Escape. If the hint only appears on hover, or Escape does not close it, the component is not shippable yet.

Domande comuni su Tooltip

Come genero un componente tooltip con l'IA?

Descrivi il trigger, il posizionamento e i tempi in un unico prompt — per esempio "un tooltip scuro sopra il trigger, 300ms di ritardo in apertura, si ribalta quando tocca il bordo del viewport, si apre anche al focus". MeDo genera insieme la logica di posizionamento, la freccia, i ritardi e il collegamento aria-describedby, così il comportamento è completo e non un semplice div in posizione assoluta con degli stili.

Qual è la differenza tra tooltip e popover?

Un tooltip è passivo: mostra una breve descrizione testuale dell'elemento che stai puntando, si chiude appena ti allontani e non contiene nulla di cliccabile. Un popover è interattivo: si apre al clic, resta aperto, contiene link, pulsanti o campi di form e intrappola o gestisce il focus. Se ti accorgi di volere un pulsante dentro un tooltip, quello che volevi era un popover.

Un tooltip deve usare aria-describedby o aria-label?

Usa aria-describedby quando il trigger ha già un nome visibile o accessibile e il tooltip aggiunge un dettaglio supplementare, poiché una descrizione viene annunciata dopo il nome. Usa aria-label quando il testo del tooltip è l'unico nome del controllo, come in un pulsante con sola icona, e in quel caso ometti aria-describedby così la stessa stringa non viene annunciata due volte.

I tooltip funzionano sui dispositivi touch?

Non in modo affidabile. Gli schermi touch non hanno uno stato di hover, e la pressione prolungata è già occupata dalla selezione del testo e dai menu contestuali, quindi qualsiasi schema di tooltip al tap va contro la piattaforma. Dai per scontato che gli utenti da telefono e tablet non lo vedano mai, e tieni tutto ciò che è essenziale in testo visibile o in un nome accessibile.

Quanto deve durare il ritardo prima che un tooltip si apra?

Da 200 a 500ms circa funziona bene, con 300ms come valore predefinito sicuro. Il ritardo esiste perché i tooltip non sfarfallino mentre il puntatore attraversa una fila di controlli diretto altrove. Abbinalo a un ritardo di chiusura molto più breve, intorno ai 100ms, così il pannello non scompare mentre il puntatore si muove verso di esso.

Un tooltip deve poter essere chiuso da tastiera?

Sì. Le WCAG richiedono che il contenuto mostrato al passaggio del mouse o al focus possa essere chiuso senza spostare puntatore o focus, che in pratica significa che Escape lo chiude. Deve inoltre restare visibile abbastanza a lungo per essere letto e rimanere sorvolabile perché il puntatore possa passarci sopra. Menziona il supporto da tastiera nel prompt e MeDo collega Escape, blur e il comportamento a ponte del passaggio del mouse.