Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Data display

Tooltip

A short hint that appears when the user hovers or focuses an element.

Selector: [muiTooltip]

Import
import { Tooltip } from '@mushilu-san/ui/data-display';
PreviewCode

Loading example…

Overview

Add muiTooltip to any element to show its text on hover and on keyboard focus. placement sets the side. The tooltip has role="tooltip", and the trigger points to it with aria-describedby while it is visible.

Escape hides the tooltip. The tooltip is a description, not the name, so the trigger still needs its own accessible name.

When to use

  • Explaining an icon-only button, such as "Copy link".
  • A short clarification of a label or value.

When not to use

  • Essential information. Users on touch devices may never see it.
  • Interactive content such as links or forms. Use a popover. Use Popover instead.

Guidelines

Do

  • Keep the text to a few words.
  • Give the trigger a visible label or an aria-label as well.

Don't

  • Do not put a button or link inside a tooltip.
  • Do not hide the only explanation of a control in a tooltip.

Accessibility

Roles and attributes

ElementRoleNotes
tooltiptooltipLinked from the trigger with aria-describedby while visible.

Keyboard

KeysAction
FocusShows the tooltip on the focused trigger.
EscapeHides the tooltip.
  • Icon-only triggers still need aria-label. The tooltip adds a description, not a name.

API

Tooltip

Selector: [muiTooltip]

NameTypeDefaultDescription
muiTooltiprequiredstring— Tooltip text content. Bound directly via the attribute selector.
placementPlacement'top' Preferred placement relative to the host element.

Tokens

  • --mui-color-text
  • --mui-color-surface-raised
  • --mui-shadow-3
  • --mui-radius-sm
  • --mui-font-size-xs