Skip to content

Tooltip

A tooltip is one line of text that appears next to a control when the pointer rests on it or keyboard focus arrives, usually to name an icon button and show its shortcut.

When to use it

Give a tooltip to an icon button, since the icon alone may not say what it does, and to a control that has a keyboard shortcut. A truncated value can show its full text in one, and an unavailable control can say what would make it available.

Touch screens have no hover, so tooltips do not appear there. Keep what people need on the page or in a popover.

Sunita Rai

Care assistant, Pokhara

Interview with a care home in Zagreb on 14 October at 09:00. Passport and police certificate received, CV uploaded on 12 September.

Anatomy

A tooltip is plain text on frosted glass. When the control has a shortcut, a keycap follows the text.

Text
12 px on an 18 px line, regular weight
--text
Padding
4 px above and below, 8 px at the sides
--space-1, --space-2
Height
26 px
Corner radius
8 px
--radius-lg
Surface
translucent glass under a strong blur, with a soft shadow. Solid where the blur cannot render
Gap to the control
8 px
--space-2
Distance from the window edge
at least 8 px
--space-2
Keycap
11 px, weight 500, 6 px corners, on the control fill with a 1 px edge
--surface-control, --border, --text-label, --radius-md
Length
at most 60 characters

Showing and hiding

The tooltip stays while the pointer is on the control or on the tooltip itself, so people can move onto it to read it. It does not time out, and only one shows at a time.

It opens below the control, centered, and moves above it at the bottom of the window. Near the sides it moves inward.

Pointer rests on the control
shows after 500 ms
Keyboard focus arrives
shows at once
Moving to another control while one shows
the next shows at once
Fade in and out
150 ms
--duration-fast
Pointer leaves the control and the tooltip
hides
Focus leaves, or Escape
hides, focus stays where it was
A press on the control
hides

Content

Name the action in a short phrase, in sentence case, with no full stop. Leave out words people can already see on the control. For an unavailable control, say what would make it available.

Permitted

  • Download CV

    Names the action of an icon button.

  • Select a candidate first

    Says why the control is unavailable.

Not permitted

  • Click here to download the CV of this candidate.

    It explains the obvious and ends with a full stop.

  • A link or a button inside a tooltip

    A tooltip holds text only. Use a popover.

Accessibility

The tooltip has role tooltip and an id. When it adds to the control's name, the control points to it with aria-describedby. When it repeats the aria-label of an icon button, the tooltip is hidden from screen readers, so the name is heard once.

A control with a shortcut states it in aria-keyshortcuts. An unavailable control that explains itself uses aria-disabled, so it still takes focus and shows its tooltip. Remove the title attribute from any control that has a tooltip.

NextToast

Tooltip

One line of text next to a control, shown on pointer rest or keyboard focus, that names it, shows its shortcut, shows a truncated value in full or says why it is unavailable.

  • Kind: component
  • Page: https://design.werklist.com/components/tooltip
  • Version: 2.1.2

When to use it

  • An icon button without a visible label
  • A control with a keyboard shortcut
  • A truncated value, to show it in full
  • An unavailable control, to say what would make it available

When not to use it

  • Anything people need to finish a task
  • Links, buttons or formatted text: use a popover
  • System feedback: use a toast or an inline message
  • Touch screens: tooltips do not show there
  • Repeating a visible label
  • Tips that open by themselves to teach a feature

Anatomy

  • Layer: above the page (--layer-popover)
  • Text: 12 px on an 18 px line, weight 400 (--text)
  • Padding: 4 px above and below, 8 px at the sides (--space-1, --space-2)
  • Height: 26 px, 30 px with a keycap
  • Radius: 8 px (--radius-lg)
  • Surface: translucent glass under a 36 px blur, with an inset top highlight, a 1 px inset rim and a soft shadow. Solid where the blur cannot render or transparency is reduced
  • Gap and window margin: 8 px and at least 8 px (--space-2)
  • Maximum width: the window width less 16 px
  • Keycap: 11 px on a 16 px line, weight 500, tabular, at least 26 px wide, 22 px high, radius 6 px, a 1 px inset edge in the border ink (--surface-control, --border, --text-label, --radius-md)

States

  • Showing on pointer rest: After 500 ms, fades in over 150 ms with 4 px of travel away from the control (--duration-fast, --ease-soft)
  • Showing on keyboard focus: At once, same fade (--duration-fast)
  • Moving between triggers: The next shows at once while one is showing
  • Hiding: When the pointer leaves both the control and the tooltip, when focus leaves, on Escape, on a press. Fades over 150 ms (--duration-fast, --ease-standard)
  • Reduced motion: The fade stays, the travel goes (--duration-fast)
  • Touch screen: Does not show

Keyboard

  • Tab onto the control: Shows the tooltip at once
  • Escape: Hides the tooltip. Focus stays on the control

Accessibility

  • role tooltip with an id. The control references it with aria-describedby when the tooltip adds to the name
  • When the tooltip repeats an icon button's aria-label, the tooltip is aria-hidden true
  • aria-keyshortcuts on the control for its shortcut
  • Unavailable controls that explain themselves use aria-disabled true, not disabled, so they receive hover and focus
  • The native title attribute is removed from any control with a tooltip
  • People can move the pointer onto the tooltip. It stays while hovered or focused and does not time out
  • Escape hides the tooltip before it closes anything behind it

Content

  • A verb phrase or a noun phrase in sentence case, with no full stop
  • Not the visible label again
  • For an unavailable control, the condition: Select a candidate first
  • At most 60 characters

Tokens

  • --layer-popover
  • --radius-lg
  • --radius-md
  • --space-1
  • --space-2
  • --text
  • --text-label
  • --surface-control
  • --border
  • --duration-fast
  • --ease-soft
  • --ease-standard

JSON

{
  "title": "Tooltip",
  "path": "/components/tooltip",
  "url": "https://design.werklist.com/components/tooltip",
  "text": "https://design.werklist.com/agent/components/tooltip",
  "summary": "A tooltip names an icon button or shows its shortcut when the pointer rests on it or the keyboard reaches it.",
  "version": "2.1.2",
  "kind": "component",
  "name": "Tooltip",
  "purpose": "One line of text next to a control, shown on pointer rest or keyboard focus, that names it, shows its shortcut, shows a truncated value in full or says why it is unavailable.",
  "use": [
    "An icon button without a visible label",
    "A control with a keyboard shortcut",
    "A truncated value, to show it in full",
    "An unavailable control, to say what would make it available"
  ],
  "avoid": [
    "Anything people need to finish a task",
    "Links, buttons or formatted text: use a popover",
    "System feedback: use a toast or an inline message",
    "Touch screens: tooltips do not show there",
    "Repeating a visible label",
    "Tips that open by themselves to teach a feature"
  ],
  "anatomy": [
    {
      "part": "Layer",
      "measure": "above the page",
      "token": "--layer-popover"
    },
    {
      "part": "Text",
      "measure": "12 px on an 18 px line, weight 400",
      "token": "--text"
    },
    {
      "part": "Padding",
      "measure": "4 px above and below, 8 px at the sides",
      "token": "--space-1, --space-2"
    },
    {
      "part": "Height",
      "measure": "26 px, 30 px with a keycap"
    },
    {
      "part": "Radius",
      "measure": "8 px",
      "token": "--radius-lg"
    },
    {
      "part": "Surface",
      "measure": "translucent glass under a 36 px blur, with an inset top highlight, a 1 px inset rim and a soft shadow. Solid where the blur cannot render or transparency is reduced"
    },
    {
      "part": "Gap and window margin",
      "measure": "8 px and at least 8 px",
      "token": "--space-2"
    },
    {
      "part": "Maximum width",
      "measure": "the window width less 16 px"
    },
    {
      "part": "Keycap",
      "measure": "11 px on a 16 px line, weight 500, tabular, at least 26 px wide, 22 px high, radius 6 px, a 1 px inset edge in the border ink",
      "token": "--surface-control, --border, --text-label, --radius-md"
    }
  ],
  "states": [
    {
      "name": "Showing on pointer rest",
      "change": "After 500 ms, fades in over 150 ms with 4 px of travel away from the control",
      "tokens": [
        "--duration-fast",
        "--ease-soft"
      ]
    },
    {
      "name": "Showing on keyboard focus",
      "change": "At once, same fade",
      "tokens": [
        "--duration-fast"
      ]
    },
    {
      "name": "Moving between triggers",
      "change": "The next shows at once while one is showing"
    },
    {
      "name": "Hiding",
      "change": "When the pointer leaves both the control and the tooltip, when focus leaves, on Escape, on a press. Fades over 150 ms",
      "tokens": [
        "--duration-fast",
        "--ease-standard"
      ]
    },
    {
      "name": "Reduced motion",
      "change": "The fade stays, the travel goes",
      "tokens": [
        "--duration-fast"
      ]
    },
    {
      "name": "Touch screen",
      "change": "Does not show"
    }
  ],
  "keys": [
    {
      "key": "Tab onto the control",
      "action": "Shows the tooltip at once"
    },
    {
      "key": "Escape",
      "action": "Hides the tooltip. Focus stays on the control"
    }
  ],
  "accessibility": [
    "role tooltip with an id. The control references it with aria-describedby when the tooltip adds to the name",
    "When the tooltip repeats an icon button's aria-label, the tooltip is aria-hidden true",
    "aria-keyshortcuts on the control for its shortcut",
    "Unavailable controls that explain themselves use aria-disabled true, not disabled, so they receive hover and focus",
    "The native title attribute is removed from any control with a tooltip",
    "People can move the pointer onto the tooltip. It stays while hovered or focused and does not time out",
    "Escape hides the tooltip before it closes anything behind it"
  ],
  "content": [
    "A verb phrase or a noun phrase in sentence case, with no full stop",
    "Not the visible label again",
    "For an unavailable control, the condition: Select a candidate first",
    "At most 60 characters"
  ],
  "tokens": [
    "--layer-popover",
    "--radius-lg",
    "--radius-md",
    "--space-1",
    "--space-2",
    "--text",
    "--text-label",
    "--surface-control",
    "--border",
    "--duration-fast",
    "--ease-soft",
    "--ease-standard"
  ]
}

Raw file: https://design.werklist.com/agent/components/tooltip