Tooltips provide a short description of a page element or control.
Use to provide a short description of an object without a label.
<div class="mds-tooltip__wrapper">
<svg class="mds-icon" aria-labelledby="title">
<title>person-padless</title>
<use xlink:href="/assets/icons/mds_icons.svg#person-padless"></use>
</svg>
<div class="mds-tooltip mds-tooltip--default mds-tooltip--height-s mds-tooltip--width-s mds-tooltip--right-center mds-tooltip--sticky tooltip-doc-site-z-index" role="tooltip">
<div class="mds-tooltip__text"> Account </div>
</div>
</div>
Use to temporarily direct attention to an object or functionality.
<div class="mds-tooltip__wrapper">
<svg class="mds-icon mds-tooltip__target mds-tooltip__target--block" aria-labelledby="title">
<title>plus</title>
<use xlink:href="/assets/icons/mds_icons.svg#plus"></use>
</svg>
<div class="mds-tooltip mds-tooltip--prompt mds-tooltip--width-l mds-tooltip--height-m mds-tooltip--sticky mds-tooltip--closable mds-tooltip--right-center tooltip-doc-site-z-index" role="tooltip">
<div class="mds-tooltip__text"> Your list is empty. Add some investments to get started. </div>
<div class=" mds-tooltip__close-button">
<button class="mds-button mds-button--small mds-button--icon-only">
<svg class="mds-icon mds-button__icon" aria-labelledby="title">
<title>remove--s</title>
<use xlink:href="/assets/icons/mds_icons.svg#remove--s"></use>
</svg>
</button>
</div>
</div>
</div>
remove--s
. Use to direct attention to an error.
<div class="mds-tooltip__wrapper">
<button class="mds-button mds-button--primary" type="button" disabled role="button"> Submit </button>
<div class="mds-tooltip mds-tooltip--error mds-tooltip--width-l mds-tooltip--height-m mds-tooltip--sticky mds-tooltip--right-center tooltip-doc-site-z-index" role="tooltip">
<div class="mds-tooltip__text"> There is a problem. Please correct all errors before submitting. </div>
</div>
</div>
There are 12 possible positions. Choose one that keeps the tooltip’s content in the viewport. For all positioning options see CSS Class References.
<div class="mds-tooltip__wrapper">
<button class="mds-button " type="button" role="button"> Right Center </button>
<div class="mds-tooltip mds-tooltip--default mds-tooltip--width-m mds-tooltip--height-s mds-tooltip--right-center tooltip-doc-site-z-index" role="tooltip">
<div class="mds-tooltip__text"> Right Center </div>
</div>
</div>
<div class="mds-tooltip__wrapper">
<button class="mds-button " type="button" role="button"> Right Bottom </button>
<div class="mds-tooltip mds-tooltip--default mds-tooltip--width-m mds-tooltip--right-bottom tooltip-doc-site-z-index" role="tooltip">
<div class="mds-tooltip__text"> Right Bottom </div>
</div>
</div>
.mds-text__anchor
, or an .mds-button
, the tip should show on focus and hide on blur.role=””
attributes on .mds-tooltip_target
as appropriate.role=”tooltip”
on the .mds-tooltip element
.Class | Applies to | Outcome |
---|---|---|
|
|
This class initializes a |
|
|
This class is always applied to a |
|
Any block, or inline-block element, most likely a |
This class should be on the immediate parent of the tooltip’s target element, and it must wrap the target and the tooltip itself. If the tooltip is triggered on hover, this is the element on which that hover is triggered. |
|
Any inline, block, or inline-block element |
This is used to enable showing/hiding the tooltip on keyboard focus of a focusable tooltip target element. For example, if the tooltip target is an |
|
|
Sets background color, drop shadow and text styling for a default tooltip. |
|
|
Sets background color, drop shadow and text styling for a prompt tooltip. |
|
|
Sets background color, drop shadow and text styling for an error tooltip. |
|
|
Gives a tooltip padding space to account for a close button. |
|
|
This is the hook set onto an anchor inside of an |
|
Any block, inline-block, or inline element |
Changes cursor to (?) symbol on hover indicating help information. |
|
|
Aligns tooltip to the top center of the invoking element. |
|
|
Aligns tooltip to the top right of the invoking element. |
|
|
Aligns tooltip to the top left of the invoking element. |
|
|
Aligns tooltip to the bottom center of the invoking element. |
|
|
Aligns tooltip to the bottom right of the invoking element. |
|
|
Aligns tooltip to the bottom left of the invoking element. |
|
|
Aligns tooltip to the right center of the invoking element. |
|
|
Aligns tooltip to the right top of the invoking element. |
|
|
Aligns tooltip to the right bottom of the invoking element. |
|
|
Aligns tooltip to the left center of the invoking element. |
|
|
Aligns tooltip to the left top of the invoking element. |
|
|
Aligns tooltip to the left bottom of the invoking element. |
Engineers should use their own JavaScript libraries and implementations that most appropriately fit within the requirements for their applications and environments.