Tooltip

Tooltips add additional context to other UI elements and appear on mouse hover or keyboard focus.

v0.1.9AlphaNot reviewed for accessibility

Description

Tooltip only appears on mouse hover or keyboard focus and contain a label or description text. Use tooltips sparingly and as a last resort. Use tooltips as a last resort. Please consider Tooltips alternatives.

When using a tooltip, follow the provided guidelines to avoid accessibility issues:

  • Tooltips should contain only non-essential text. Tooltips can easily be missed and are not accessible on touch devices so never use tooltips to convey critical information.
  • Tooltip should be rendered through the API of Primer::ButtonComponent, Link, or Primer::IconButton. Avoid using Tooltip a standalone component unless absolutely necessary (and only on interactive elements).

Arguments

NameDefaultDescription
for_id

N/A

String

The ID of the element that the tooltip should be attached to.

type

N/A

Symbol

One of :description or :label.

direction

:s

Symbol

One of :e, :n, :ne, :nw, :s, :se, :sw, or :w.

text

N/A

String

The text content of the tooltip. This should be brief and no longer than a sentence.

system_arguments

N/A

Hash

Examples

View in Lookbook