Skip to content
Autumn 2026 Mesh Release and Design Tokens v2 now available! Read the announcement

A Tooltip is used to display text as either a label, description or supplementary information. Content contained within a Tooltip should be contextual, useful and nonessential. Because a Tooltip is hidden from the immediate view of the user, it should only be used as a last resort—often when there is not enough space to display the relevant information otherwise.

Installation

bash
npm install @nib-group/mesh-tooltip

Usage

The tooltip component utilises the render-prop pattern.

jsx
import Tooltip from '@nib-group/mesh-tooltip';
<Tooltip id="foo" placement="bottom" tooltipContents={<Copy>Lorem ipsum dolor</Copy>}>
{({triggerProps}) => (
<Inline space={4} align="center">
<div aria-label="Help" {...triggerProps}>
<InfoSystemIcon />
</div>
</Inline>
)}
</Tooltip>

Interactive demo

Hover over the Info icon below to display the tooltip.

jsx
<GreyBox>
  <Tooltip id="foo" placement="bottom" tooltipContents={<Copy>Lorem ipsum dolor</Copy>}>
    {({triggerProps}) => (
      <Inline space={4} align="center">
        <div aria-label="Help" {...triggerProps}>
          <InfoSystemIcon />
        </div>
      </Inline>
    )}
  </Tooltip>
</GreyBox>

Note: GreyBox is not a tooltip component, it is purely for demonstration purposes.

Props

PropTypeDefaultDescription
id (required)stringThe id of the tooltip, used for aria-describedby on the trigger element.
tooltipContents (required)nodeThe element to be rendered within the tooltip. Can be multiple nested components, but must not include anything interactive.
children (required)functionA render function that receives { triggerProps } to be spread onto the trigger element.
placementstring'top'Where to place the tooltip relative to the trigger. If the viewport edge impacts this preference, the opposite may be used.
sizestring'default'The size of the tooltip. Can be 'small' or 'default'.
delayShownumber0Delay in milliseconds before showing the tooltip on hover.
delayHidenumber0Delay in milliseconds before hiding the tooltip on hover out.
closeOnOutsideClickbooleantrueWhether to close the tooltip when clicking outside of it.
closeOnTriggerHiddenbooleanfalseWhether to close the tooltip when the trigger element scrolls out of view.
defaultVisiblebooleanfalseThe initial open state of the tooltip when uncontrolled.
followCursorbooleanfalseWhether the tooltip should follow the cursor position.
interactivebooleanfalseWhether the tooltip stays open when the user hovers over it.
offset[number, number][0, 16]The offset of the tooltip from the trigger as [crossAxis, mainAxis].
onVisibleChangefunctionCallback fired when the tooltip open state changes. Receives (state: boolean).
triggerstring | string[] | null['hover', 'focus'] / ['click', 'focus']The interaction(s) that trigger the tooltip. Can be 'click', 'right-click', 'hover', or 'focus'. Defaults to hover + focus on desktop, click + focus on mobile.
visiblebooleanControls the tooltip open state. When provided, the tooltip becomes controlled.

Considerations

Never hide vital content in a Tooltip.

Content

Content within the tooltip should be kept short. Tooltip content should contain brief read-only text and should be set in sentence case. Multiple text elements can be included, but the tooltip should not include any interactive elements. If interaction is needed, consider using our Modal component.

Interaction

A Tooltip requires a trigger element for the user to interact with. Trigger elements can be anything but should preference using either the Icon or Link components.

On desktop, a Tooltip can be interacted with via hover and focus events. On mobile devices tap is the default interaction.