How to use the tooltip generator
- Choose the position: top, right, bottom or left.
- Pick an animation (fade, scale, slide or instant) and set the delay before it appears.
- Write the button text and tooltip text.
- Shape it: arrow on or off and its size, gap, corner radius, padding, maximum width, font size and shadow.
- Set colors and check the contrast.
- Export HTML, CSS and the small JavaScript for Escape, or SCSS, Tailwind or React.
The markup
<span class="tip">
<button class="tip__trigger" type="button" aria-describedby="tip-1">Save draft</button>
<span class="tip__bubble" role="tooltip" id="tip-1">Saves your changes without publishing them.</span>
</span>
The bubble is hidden with opacity and visibility, so it isn’t announced until it’s shown. :hover and :focus-within on the wrapper reveal it after the delay.
Worked examples
Example 1: icon buttons in a toolbar
Use Classic with a short label like “Bold” for each icon button. The button still needs its own accessible name (an aria-label or hidden text). The tooltip just shows it visually.
Example 2: explaining a disabled feature
Use Light soft to explain why an option is unavailable (“Upgrade to Pro to export PDFs”). Make sure the trigger can still receive focus; disabled buttons can’t, so use aria-disabled instead.
Example 3: copy confirmation
Use Pill with the text “Copied!” and the Instant animation, and add the open class from your copy script for a moment after copying.
Tips
- Keep tooltip text short: one sentence at most.
- A 100–300ms delay avoids tooltips flashing as the pointer passes over.
- On touch screens, tooltips appear on tap focus at best, so never hide important information in them.
Common mistakes
- Tooltips on non-focusable elements. A tooltip on a plain
spannever appears for keyboard users. - Links inside tooltips. People can’t reliably reach them. Use a popover or dialog instead.
- Tooltips that cover the trigger. Choose a position that keeps the trigger and nearby content visible.