MeDo

Gerador de Tooltip com IA.

Descreva a dica que você precisa e o MeDo gera todo o comportamento — atrasos de abertura e fechamento, inversão para longe das bordas do viewport, uma seta que continua apontando para o gatilho, acionamento por foco de teclado e a ligação aria-describedby.

Tooltip
Tooltip

O tooltip é o único componente que um terço dos seus usuários nunca vai ver

Hover não existe em uma tela de toque. Não há gesto no celular que signifique de forma confiável "me mostre a descrição sem ativar este controle", o que significa que todo tooltip é invisível para uma parcela grande do seu tráfego. Esse único fato resolve a maioria das discussões de design sobre tooltips antes de começarem: um tooltip só pode carregar informação de que o usuário não precisa. Requisitos de campo, mensagens de erro, ressalvas de preço e o significado de um botão só com ícone precisam estar em algum lugar visível ou em um nome acessível. Trate o tooltip como um refinamento sobre uma interface que já funciona sem ele, e as questões de acessibilidade praticamente se respondem sozinhas.

6 modelos

Modelos de Tooltip que você pode gerar

Cada modelo é um prompt real, não uma captura de tela. Copie para qualquer editor de IA, ou rode no MeDo e receba código 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.

Teste no 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.

Teste no 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.

Teste no 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.

Teste no 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.

Teste no 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.

Teste no MeDo

Como personalizar seu Tooltip

Defina os atrasos de abertura e fechamento separadamente

Um atraso único compartilhado está errado nas duas direções. Cerca de 300ms antes de abrir evita que tooltips pisquem enquanto o ponteiro atravessa uma barra de ferramentas, enquanto um atraso curto de 100ms no fechamento permite que o ponteiro vá do gatilho até o tooltip sem o painel desaparecer no meio do caminho.

Peça detecção de colisão, não um lado fixo

Um tooltip fixado acima será cortado pelo topo do viewport ou pela borda de um contêiner com rolagem. Especifique um lado preferido mais alternativas para que o componente inverta e desloque por conta própria, e diga que a seta deve continuar apontando para o gatilho após o movimento.

Exija que o foco também acione, não só o hover

Se o tooltip só responde ao mouse, quem usa teclado não recebe nada. Peça que ele abra em focus-visible e feche com Escape e blur, que é também o que o torna utilizável para quem navega com dispositivo de switch ou leitor de tela.

Mantenha o conteúdo passivo e apenas textual

No momento em que um tooltip contém um link, um botão ou texto copiável, ele precisa de uma forma de ser alcançado e mantido aberto, e deixa de ser um tooltip. Diga que o conteúdo é texto simples e não interativo, e recorra a um popover quando precisar de algo clicável dentro.

Quem usa o componente Tooltip

Dashboard ou ferramenta administrativa

Botões de barra de ferramentas só com ícone carregando um nome acessível de verdade mais um tooltip que repete o rótulo para usuários de mouse com visão, com o atraso de abertura ignorado quando o ponteiro se move entre botões adjacentes.

Produto SaaS

Uma dica na legenda de um gráfico explicando como uma métrica é calculada, invertendo para baixo do gatilho perto do topo do painel e fechando ao rolar para nunca flutuar desconectada do ponto que descreve.

Loja de e-commerce

Abreviações da tabela de tamanhos e ícones de selos de frete anotados no hover, com a mesma informação repetida no texto visível da página de produto, porque quem compra pelo celular nunca vai acionar o hover.

Documentação para desenvolvedores

Tokens de código inline e abreviações que revelam uma assinatura de tipo de uma linha no hover ou no foco, limitados a uma largura máxima estreita para que o painel nunca cubra o exemplo de código que está explicando.

Padrões de Tooltip para diferentes sites

O mesmo componente tooltip, ajustado ao tipo de site em que ele entra.

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.

Estilos e variações de Tooltip

Escolha a variação que combina com o resto da página e gere-a.

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 em React, Next.js, Vue e Svelte

React, Next.js, Vue 3, SvelteKit, Astro ou HTML puro — o mesmo tooltip, seis formas de integrar.

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>
  )
}

Como adicionar o seu Tooltip a um projeto

Quatro passos, de escolher um modelo de tooltip até subir para produção.

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.

Perguntas comuns sobre Tooltip

Como gerar um componente tooltip com IA?

Descreva o gatilho, o posicionamento e o tempo em um único prompt — por exemplo "um tooltip escuro acima do gatilho, 300ms de atraso de abertura, inverte ao encostar na borda do viewport, abre também no foco". O MeDo gera a lógica de posicionamento, a seta, os atrasos e a ligação aria-describedby juntos, então o comportamento vem completo, não como uma div com position absolute estilizada.

Qual é a diferença entre tooltip e popover?

Um tooltip é passivo: mostra uma descrição curta em texto do elemento que você está apontando, fecha assim que você se afasta e não contém nada clicável. Um popover é interativo: abre no clique, permanece aberto, contém links, botões ou campos de formulário e prende ou gerencia o foco. Se você se pegar querendo um botão dentro de um tooltip, o que você queria era um popover.

Um tooltip deve usar aria-describedby ou aria-label?

Use aria-describedby quando o gatilho já tem um nome visível ou acessível e o tooltip acrescenta detalhe complementar, já que uma descrição é anunciada depois do nome. Use aria-label quando o texto do tooltip é o único nome que o controle tem, como em um botão só com ícone, e nesse caso dispense o aria-describedby para que a mesma string não seja anunciada duas vezes.

Tooltips funcionam em dispositivos de toque?

Não de forma confiável. Telas de toque não têm estado de hover, e o toque longo já está reservado para seleção de texto e menus de contexto, então qualquer padrão de tooltip no toque briga com a plataforma. Assuma que usuários de celular e tablet nunca vão vê-lo e mantenha tudo o que é essencial em texto visível ou em um nome acessível.

Quanto deve durar o atraso antes de um tooltip abrir?

Aproximadamente 200 a 500ms funciona bem, com 300ms como padrão seguro. O atraso existe para que os tooltips não fiquem piscando enquanto o ponteiro atravessa uma fileira de controles a caminho de outro lugar. Combine-o com um atraso de fechamento bem mais curto, de cerca de 100ms, para que o painel não desapareça enquanto o ponteiro se move em direção a ele.

Um tooltip precisa poder ser fechado pelo teclado?

Sim. A WCAG exige que conteúdo exibido no hover ou no foco possa ser dispensado sem mover o ponteiro ou o foco, o que na prática significa que Escape o fecha. Ele também precisa permanecer visível tempo suficiente para ser lido e continuar hoverable para que o ponteiro possa passar sobre ele. Mencione suporte a teclado no seu prompt e o MeDo liga Escape, blur e o comportamento de ponte no hover.