MeDo

AIツールチップジェネレーター。

必要なヒントを説明すれば、MeDoが挙動をまるごと生成します — 開閉ディレイ、ビューポート端を避ける反転、常にトリガーを指し続ける矢印、キーボードフォーカスでの起動、そしてaria-describedbyの紐付け。

ツールチップ
ツールチップ

ツールチップは、ユーザーの3分の1が決して目にしないコンポーネントです

タッチスクリーンにホバーは存在しません。「このコントロールを操作せずに説明だけ見せて」を確実に意味するスマートフォンのジェスチャーはなく、つまりすべてのツールチップはトラフィックの相当な割合に対して不可視です。この一点だけで、ツールチップ設計の議論はほとんど始まる前に決着します。ツールチップに載せられるのは、ユーザーが必要としない情報だけです。入力項目の要件、エラーメッセージ、価格の注意書き、アイコンのみのボタンの意味は、すべて目に見える場所か、アクセシブルな名前の中に置かなければなりません。ツールチップは、それがなくても成立するインターフェースの上に載せる仕上げだと捉えれば、アクセシビリティの疑問はおおむね自ずと解決します。

6 個のテンプレート

生成できる ツールチップ テンプレート

どのテンプレートもスクリーンショットではなく実際のプロンプトです。任意の AI エディタに貼り付けるか、MeDo で実行して 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.

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.

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.

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.

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.

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.

MeDoで試す

ツールチップ をカスタマイズする方法

開くディレイと閉じるディレイを別々に設定する

共通の一つのディレイは、どちらの方向にも不適切です。開く前の約300msは、ポインタがツールバーを横切る際にツールチップが点滅するのを防ぎ、100msという短い閉じるディレイは、パネルが動作中に消えることなくポインタがトリガーからツールチップへ移動できるようにします。

固定の表示位置ではなく衝突検出を指定する

上に固定したツールチップは、ビューポートの上端やスクロールコンテナの縁で切れてしまいます。優先する側とフォールバックを指定して、コンポーネント自身が反転・シフトするようにし、移動後も矢印がトリガーを指し続けるよう明記してください。

ホバーだけでなくフォーカスでも起動させる

マウスにしか反応しないツールチップでは、キーボードユーザーは何も得られません。focus-visibleで開き、Escapeとblurで閉じるよう指定してください。これはスイッチデバイスやスクリーンリーダーで操作する人にとっても使えるものにする条件です。

内容は受動的なテキストのみに保つ

ツールチップにリンク、ボタン、コピー可能なテキストが入った瞬間、そこへ到達し開いたままにする手段が必要になり、もはやツールチップではなくなります。内容はインタラクティブでないプレーンテキストだと明記し、中にクリックできるものが必要ならポップオーバーを使ってください。

ツールチップ コンポーネントを使うのは誰か

ダッシュボード・管理ツール

アイコンのみのツールバーボタンに実質的なアクセシブルな名前を持たせ、加えて晴眼のマウス利用者向けにラベルを繰り返すツールチップを添える。隣接するボタン間をポインタが移動する場合は開くディレイをスキップします。

SaaSプロダクト

指標の算出方法を説明するグラフ凡例のヒント。パネル上端付近ではトリガーの下側へ反転し、スクロールで閉じるため、説明対象から切り離されて浮くことがありません。

Eコマースストア

サイズ表の略語や配送バッジのアイコンをホバーで注記しつつ、同じ情報を商品ページの本文にも明示する。スマートフォンの買い物客はホバーを起動できないからです。

開発者ドキュメント

インラインのコードトークンや略語が、ホバーまたはフォーカスで1行の型シグネチャを表示する。最大幅を狭く制限し、パネルが説明対象のコードサンプルを覆わないようにします。

サイト種別ごとの ツールチップ パターン

同じ ツールチップ コンポーネントを、掲載するサイトの種類に合わせて調整します。

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.

ツールチップ のスタイルとバリアント

ページ全体のトーンに合うバリアントを選び、そのまま生成します。

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.

React・Next.js・Vue・Svelte での ツールチップ

React、Next.js、Vue 3、SvelteKit、Astro、素の HTML — 同じ ツールチップ を 6 通りの方法で組み込めます。

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

ツールチップ をプロジェクトに追加する方法

ツールチップ テンプレートを選んで本番に載せるまでの 4 ステップ。

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.

ツールチップに関するよくある質問

AIでツールチップコンポーネントを生成するには?

トリガー、配置、タイミングを一つのプロンプトで説明してください。たとえば「トリガーの上にダークなツールチップ、開くディレイ300ms、ビューポート端で反転、フォーカスでも開く」のように。MeDoは位置決めロジック、矢印、ディレイ、aria-describedbyの紐付けをまとめて生成するため、スタイルを当てただけの絶対配置divではなく、挙動として完成しています。

ツールチップとポップオーバーの違いは?

ツールチップは受動的です。指している要素の短いテキスト説明を表示し、離れればすぐ閉じ、クリックできるものは含みません。ポップオーバーはインタラクティブです。クリックで開き、開いたままになり、リンクやボタン、フォームフィールドを含み、フォーカスを保持または管理します。ツールチップの中にボタンを置きたくなったなら、必要だったのはポップオーバーです。

ツールチップにはaria-describedbyとaria-labelのどちらを使うべき?

トリガーに既に可視の名前またはアクセシブルな名前があり、ツールチップが補足的な詳細を加える場合はaria-describedbyを使います。説明は名前の後に読み上げられるためです。アイコンのみのボタンのように、ツールチップのテキストがそのコントロールの唯一の名前である場合はaria-labelを使い、同じ文字列が二度読み上げられないよう、その場合はaria-describedbyを省いてください。

ツールチップはタッチデバイスで動作しますか?

確実には動作しません。タッチスクリーンにはホバー状態がなく、長押しはすでにテキスト選択やコンテキストメニューに割り当てられているため、タップでツールチップを出すパターンはプラットフォームと衝突します。スマートフォンやタブレットのユーザーは決して目にしないと想定し、重要な情報は可視のテキストかアクセシブルな名前に置いてください。

ツールチップが開くまでのディレイはどのくらいが適切?

おおよそ200〜500msがうまく機能し、300msが無難なデフォルトです。ディレイは、ポインタが別の場所へ向かう途中でコントロールの列を横切る間にツールチップがちらつかないために存在します。これをはるかに短い約100msの閉じるディレイと組み合わせ、ポインタがツールチップへ向かっている間にパネルが消えないようにしてください。

ツールチップはキーボードで閉じられる必要がありますか?

はい。WCAGは、ホバーまたはフォーカスで表示されたコンテンツをポインタやフォーカスを動かさずに閉じられることを求めており、実際にはEscapeで閉じることを意味します。加えて読むのに十分な時間表示され続け、ポインタが上を通れるようホバー可能である必要があります。プロンプトでキーボード対応に言及すれば、MeDoがEscape、blur、ホバーブリッジの挙動を実装します。