A tooltip is a content popup that is triggered by hover, focus or tap (mobile) and contains contextual information abut the item that has focus.
Examples
Hover over me to show the tooltip above.
Hover over me to show the tooltip to the right.
Hover over me to show the tooltip below.
Hover over me to show the tooltip to the left.
Usage
Rules
- Tooltips are visible on hover and focus of parent items and provide context for that item when it has focus
- In general the use of tooltips should be limited as it‘s preferred to have visible descriptions or intructions
- If the tooltip content can be opt-in, consider using a toggletip instead
Constraints
- Tooltips can only be opened by hover or focusing the trigger element
- Tooltips are closed with the opposite action defined in the
data-trigger
- Links and text formatting will not work in the tooltip (links should be avoided anyway because the popup itself is not be focusable)
- Tooltips leverage edge detection and will adjust accordingly to the viewport. For example, a tooltip with position set to
top
may actually appear on the bottom if the top edge will not be visible off the top edge of the viewport, and vice versa. - Only one tooltip can be open at a time
Principles
- Tooltips provide a user with more information within context
Accessibility
- Tooltips use
aria-describedby
to associate the trigger with the dynamically generated popup
Configuration
data-tooltip Required |
Use on the element that will be trigger the tooltip |
title Required |
The |
data-trigger Modifier |
can be |
data-prevent-default Modifier |
Can be |
data-modal-tooltip Modifier |
Can be |
data-placement Modifier |
Can be |
- Last updated April 3, 2017
- Authorable - Yes
- Core - Tooltips