Skip to content

Tooltip

Displays contextual information in a popup anchored to a trigger element. For attaching a tooltip to an external ref (without wrapping children), use the `useTooltip` hook directly.

Hover for details
<Tooltip
content="Helpful tooltip text"
placement="above"
alignment="center"
>
Hover for details
</Tooltip>
<Tooltip {...args}>
<Button label="Hover me" />
</Tooltip>
<div style={{display: 'flex', gap: '1rem', padding: '4rem'}}>
<Tooltip content="Above" placement="above">
<Button label="Above" />
</Tooltip>
<Tooltip content="Below" placement="below">
<Button label="Below" />
</Tooltip>
<Tooltip content="Start" placement="start">
<Button label="Start" />
</Tooltip>
<Tooltip content="End" placement="end">
<Button label="End" />
</Tooltip>
</div>
<div style={{display: 'flex', gap: '2rem', padding: '4rem'}}>
<Tooltip alignment="start" content="Aligned to start" placement="above">
<Button label="Start" />
</Tooltip>
<Tooltip alignment="center" content="Aligned to center" placement="above">
<Button label="Center" />
</Tooltip>
<Tooltip alignment="end" content="Aligned to end" placement="above">
<Button label="End" />
</Tooltip>
</div>
Hover for details
<Tooltip
content="Helpful tooltip text"
placement="above"
alignment="center"
isEnabled={false}
>
Hover for details
</Tooltip>
<Tooltip
{...args}
content={
<div style={{display: 'flex', flexDirection: 'column', gap: 4}}>
<Text type="label">Keyboard shortcut</Text>
<Text color="secondary" type="supporting">
Press Cmd+K to open the command palette
</Text>
</div>
}>
<Button label="Help" />
</Tooltip>
Hover this badge
<UseTooltipHookStory />
Underlined on hover
<Tooltip
content="Helpful tooltip text"
placement="above"
alignment="center"
hoverIndication="always"
>
Underlined on hover
</Tooltip>
Focus me (non-interactive element)
<Tooltip
content="Shown on focus even though div is not natively focusable"
focusTrigger="always">
<span role="button" style={{padding: '0.5rem 1rem'}} tabIndex={0}>
Focus me (non-interactive element)
</span>
</Tooltip>
<Tooltip content="Only shown on hover, never on focus" focusTrigger="never">
<Button label="Hover only" />
</Tooltip>

Displays contextual information in a popup anchored to a trigger element. For attaching a tooltip to an external ref (without wrapping children), use the `useTooltip` hook directly.

PropTypeDefaultDescription
alignment"center" | "end" | "start"'center'Cross-axis alignment of the tooltip relative to the anchor.
children*ReactNodeElement(s) that the tooltip is anchored to.
classNamestringAdditional CSS class names applied to the wrapper.
content*ReactNodeContent rendered inside the tooltip popup.
contentStyleCSSPropertiesInline styles applied to the tooltip content area.
data-testidstringTest ID applied to the wrapper.
delaynumber200Delay in milliseconds before the tooltip appears.
focusTrigger"auto" | "always" | "never"'auto'How focus interactions trigger the tooltip.
hideDelaynumber0Delay in milliseconds before the tooltip hides after leaving.
hoverIndication'always' | 'auto' | 'never''auto'Dashed underline display for tooltip triggers.
isEnabledbooleantrueWhether the tooltip can be shown.
placement"end" | "start" | "above" | "below"'above'Preferred placement of the tooltip relative to the anchor.
refRef<HTMLDivElement | HTMLSpanElement>Ref forwarded to the wrapper element.
styleCSSPropertiesInline styles applied to the wrapper.