Tooltip
Tooltips display informative text when users hover over, focus on, or tap an element. The library provides styling for both simple "plain" tooltips and complex "rich" tooltips.
Theme Variables
You can customize the inner padding of the tooltips by overriding their CSS variables.
:root {
--air-tooltip-plain-padding-x: calc(var(--spacing) * 2); /* 8px */
--air-tooltip-plain-padding-y: var(--spacing); /* 4px */
--air-tooltip-rich-padding-x: calc(var(--spacing) * 4); /* 16px */
--air-tooltip-rich-padding-y: calc(var(--spacing) * 3); /* 12px */
}Composed Utilities
The library offers two main composed utilities depending on the complexity of the content you need to display.
NOTE
Positioning tooltips (e.g., above, below, or beside an element) requires JavaScript. These CSS utilities only handle the visual styling and fade-in animations based on the data-state="visible" attribute.
Plain Tooltip
Plain tooltips briefly describe an element or action. They are non-interactive and use high-contrast inverse colors to ensure readability against most backgrounds.
<!-- Toggle data-state="visible" to trigger fade-in animation -->
<div class="tooltip-plain" data-state="visible" role="tooltip">
Save document
</div>tooltip-plain: Combinestooltip-base(fade transitions),tooltip-plain-layout(small typography and padding), andtooltip-plain-surface(usesinverse-surfaceandinverse-on-surfacecolors). It explicitly appliespointer-events: noneso it doesn't block interactions with elements underneath.
Rich Tooltip
Rich tooltips provide more detailed context or contain interactive elements like links and buttons. They use standard surface colors to accommodate longer reading times.
<div class="tooltip-rich shadow-2" data-state="visible" role="tooltip">
<h3 class="title-small">Rich Tooltip Title</h3>
<p class="body-medium">Provides more detailed information and can include interactive elements.</p>
<button class="button-text-primary mt-2">Learn more</button>
</div>tooltip-rich: Combinestooltip-base,tooltip-rich-layout(medium typography, larger padding, andpointer-events-auto), andtooltip-rich-surface(usessurface-variantbackground andon-surface-varianttext). Because rich tooltips can contain interactive elements, they do not block pointer events.
Animation & State
Both tooltip variants utilize the tooltip-base utility, which defaults to opacity: 0 and visibility: hidden. When your JavaScript logic applies the data-state="visible" attribute, the tooltip fades in smoothly using the standard Material duration-short timing.