Tooltip
Tooltips display more information when users hover over, focus on, or interact with an element.
Example
Anatomy
- Container: Serves to house information and depending on situation where you want the tooltip to appear.
- Text: Serves to tell users what the tooltip is about.
Spacing
Within the tooltip
Ensure that there is a min of 16px spacing within the tooltip.
Usage guidelines
Best practices:
- Avoid long delays for tooltips to appear or disappear. They should be responsive enough to be useful without being annoying.
- Do not overuse tooltips. Too many tooltips can clutter the interface and overwhelm the user.
Tooltip should be used when:
- You want to provide additional explanation for a form field that may be unfamiliar.
Tooltip should not be used when:
- Information is vital to task completion.
Usability guidelines
Position tooltips so they don't block content
When choosing the place to display the tooltip, make sure you don't cover important content.
Tooltips should be consistent in style and design
This is so that it is more intuitive to users.
Provide sufficient contrasts
A moderate contrast is important to ensure the tooltips are more visible to users.
Behaviour
Tooltips should dynamically adjust their position to ensure they remain within the viewport and are fully visible, even if the triggering element is near the edge of the screen. Tooltips should also disappear when the user moves the mouse away from the element.
Accessibility guidelines
Aria attributes
-
The element that serves as the tooltip container has
role="tooltip"
. -
The element that triggers the tooltip references the tooltip element with
aria-describedby
.
Keyboard accessibility
Hoverable tooltips:- Tab will open the tooltip when focusing on the tooltip's target element. Shifting focus away from tooltip's target element dismisses the tooltip.
- Enter opens the tooltip when tooltip's target element is focused. The focus remains on the target element.
Focus indicator
- Focus indicator should be clearly visible when a header is focused.
- Move focus to the accordion content when it is expanded, if necessary.
- Ensure that focusable elements within the accordion panel can be navigated using the keyboard.
Tooltip design tokens
Last updated 02 October 2024