Tooltip
A plain label on hover or focus, or a rich tooltip with a subhead and an action.
import { Tooltip, RichTooltip, TooltipTrigger, RichTooltipTrigger } from '@windmorph/react';Purpose
A tooltip gives a brief hint about an element. A plain tooltip is a short label for a control such as an icon button; a rich tooltip adds a subhead, supporting text and an optional action for a little more context. For a message that needs a response use a dialog, not a tooltip.
Both forms wrap their trigger: TooltipTrigger with a Tooltip, or RichTooltipTrigger with a RichTooltip. The trigger must read TriggerContext, which the library buttons already do.
Avoid persistent rich tooltips on icon buttons, as M3 advises: an icon button needs its plain tooltip to say what it does, and a persistent tooltip would take over its press. Open persistent rich tooltips from a dedicated control, such as an information button beside the text they explain.
When not to use
Don't hide essential information in a tooltip; put it in the UI. Touch users cannot hover.
See also
- Tooltip on m3.material.io: Material's own guidelines, with anatomy and specs.
- Icon button: A compact icon-only action; requires an accessible name.
- Badge: A small dot or a short count or label, placed on an anchor with BadgedBox.