Latitude ComponentsLibrary 0.1.0

Tooltip

A short text label shown on hover, keyboard focus or long-press: to name icon-only buttons and give brief hints. Keep it to a few words, never put actions in it, and never make it the only way to get information. Rules: UX Elements & Rules → Tooltip (R-O2).

Add it to a page

Load the pinned file once in your Latitude Site or web page, then use the tag.

<script type="module" src="https://web-components.sites.latd.com/components/lat-tooltip/0.1.0/lat-tooltip.js"></script>

The file is an ES module. It loads Lit, the design-system tokens and the Roobert stylesheet from this catalog once per page, however many components you use.

Version0.1.0
File/components/lat-tooltip/0.1.0/lat-tooltip.js (2.7 KB gzipped)
SHA-25698186d539a8e23296b62af14b16a204dd3c1b1dff021d43a50a480b824f42a42

Place it right after its trigger, or point to the trigger's id with for. The trigger gets aria-describedby, so screen readers read the tooltip as its description. Give an icon button its own label as well: the label names it, the tooltip shows that name to sighted users.

Permutations

Hover a trigger for a second, or Tab to it. Once one tooltip has shown, the next shows at once for a second. Escape hides it.

On icon buttons: hover, focus or long-press

Dark
Copy link Upload New: AI insights
Light
Copy link Upload New: AI insights
<lat-icon-button label="Copy link"><lat-icon name="link"></lat-icon></lat-icon-button>
<lat-tooltip>Copy link</lat-tooltip>
<lat-icon-button label="Upload"><lat-icon name="upload"></lat-icon></lat-icon-button>
<lat-tooltip shortcut="⌘U">Upload</lat-tooltip>
<lat-icon-button label="Ask AI" variant="primary"><lat-icon name="ai"></lat-icon></lat-icon-button>
<lat-tooltip prominent>New: AI insights</lat-tooltip>

Placements

Dark
Below Shown below by default Above Shown above Right Shown right Left Shown left
Light
Below Shown below by default Above Shown above Right Shown right Left Shown left
<lat-button size="sm">Below</lat-button>
<lat-tooltip>Shown below by default</lat-tooltip>
<lat-button size="sm">Above</lat-button>
<lat-tooltip placement="above">Shown above</lat-tooltip>
<lat-button size="sm">Right</lat-button>
<lat-tooltip placement="right">Shown right</lat-tooltip>
<lat-button size="sm">Left</lat-button>
<lat-tooltip placement="left">Shown left</lat-tooltip>

Shown in place

Dark
Copy link Upload New: AI insights Above Right Left
Light
Copy link Upload New: AI insights Above Right Left
<lat-tooltip inline>Copy link</lat-tooltip>
<lat-tooltip inline shortcut="⌘U">Upload</lat-tooltip>
<lat-tooltip inline prominent>New: AI insights</lat-tooltip>
<lat-tooltip inline placement="above">Above</lat-tooltip>
<lat-tooltip inline placement="right">Right</lat-tooltip>
<lat-tooltip inline placement="left">Left</lat-tooltip>

Attached by id

Dark
Share
<lat-icon-button id="share-study" label="Share"><lat-icon name="share"></lat-icon></lat-icon-button>
<lat-tooltip for="share-study">Share</lat-tooltip>

Attributes

AttributeValuesNotes
foridThe trigger. Without it, the element just before the tooltip.
placementbelow (default), above, right, leftAbove when most interactive elements are at the bottom; right when elements are stacked on the left, left when stacked on the right. Flips when there's no room.
prominentbooleanFor announcements.
shortcuttextA keyboard shortcut in a key cap, such as ⌘U.
openbooleanWhether it's showing. show() and hide() work too.
inlinebooleanShows it in the page flow, always visible and detached from any trigger. For previews and mockups.