A tooltip shows supplemental information related to a specific UI element. The tooltip displays when a user hovers, places focus or taps on the corresponding UI element.
<div class="luci-tooltip">
<div class="luci-tooltip__trigger" aria-describedby="luci-tooltip-71170">
<svg class="luci-icon" aria-hidden="true">
<use xlink:href="/icons/luci.svg#help">
</use>
</svg>
</div>
<div class="luci-tooltip__content" role="tooltip" id="luci-tooltip-71170">
<div class="luci-tooltip__content-inner">
<div class="luci-tooltip__text"> This is a default tooltip on an icon. </div>
</div>
</div>
</div>
<div class="luci-tooltip luci-tooltip--hidden-on-hover">
<div class="luci-tooltip__trigger" aria-describedby="luci-tooltip-81956">
<svg class="luci-icon" aria-hidden="true">
<use xlink:href="/icons/luci.svg#help">
</use>
</svg>
</div>
<div class="luci-tooltip__content" role="tooltip" id="luci-tooltip-81956">
<div class="luci-tooltip__content-inner">
<div class="luci-tooltip__text"> This is a default tooltip on an icon triggerd on click only. </div>
</div>
</div>
</div>
alt
text that describes the tooltip content for screen readers.luci-tooltip__content
element use the role="tooltip"
attribute.luci-tooltip__trigger
element should use the aria-describedby
attribute which references the id
of the associated luci-tooltip__content
element.Class | Applies to | Outcome |
---|---|---|
|
Any |
Adds the tooltip container class. |
|
Any |
Adds the tooltip trigger behavior. |
|
|
Positions the tooltip above the trigger element and aligned to the left. |
|
|
Positions the tooltip above the trigger element and aligned to the right. |
|
|
Positions the tooltip below and the trigger element and aligned to the center. |
|
|
Positions the tooltip below the trigger element and aligned to the left. |
|
|
Positions the tooltip below the trigger element and aligned to the right. |
|
|
Positions the tooltip to the left of the trigger element and aligned to the center. |
|
|
Positions the tooltip to the left of the trigger element and aligned to the bottom. |
|
|
Positions the tooltip to the left of the trigger element and aligned to the top. |
|
|
Positions the tooltip to the right of the trigger element and aligned to the center. |
|
|
Positions the tooltip to the right of the trigger element and aligned to the bottom. |
|
|
Positions the tooltip to the right of the trigger element and aligned to the top. |
|
|
Applies visibility property to tooltip. |
|
|
Removes the "appear on hover" behavior and only allows the tooltip to be shown on click. |