Tooltip

A short label that appears on hover and focus. Near black in both themes, as in the app. It waits a moment, then fades in while drifting out from the trigger. Once one has shown, the next opens without waiting.

On icon buttons

Automatic: hover these, then move along the row. After the first, the rest open at once.

<!-- Icon buttons get one from their aria-label -->
<Button variant="ghost" square iconLeft="pen" aria-label="Edit" />

<!-- Anything else: spread the trigger props -->
<Tooltip content="Last fix 2 min ago">
	{#snippet children({ props })}
		<span {...props} tabindex="0">AIS</span>
	{/snippet}
</Tooltip>

Sides

Top by default. It flips if there isn't room.

On anything

Wrap any element; it receives the trigger props.

AIS

Rules

  • Every icon-only button has one. Button does it for you: a square button shows its aria-label.
  • Name the thing in one to three words. Explanations belong in the page or an info popover.
  • Only for things whose label isn’t visible. A button that says “Delete” doesn’t need a tooltip saying Delete.
  • Nothing clickable inside. A tooltip disappears when the pointer leaves, so a link in it can’t be reached.
  • Never the only way to learn something essential: touch screens have no hover.