Open Tooltip This is a description of the button
<orb-button id="popover-trigger">Open Tooltip</orb-button>
<orb-tooltip for="popover-trigger">
  This is a description of the button
</orb-tooltip>

Labels for Icon Buttons

By default, a tooltip describes its trigger. For a button with only an icon, set type="label" so the tooltip names the button instead. Otherwise a screen reader announces the name twice, once from aria-label and once from the description.

Keep an aria-label on the button as well. It names the button until the tooltip loads, and the tooltip replaces it after.

Share Delete
<orb-stack mode="row">
  <orb-button id="tooltip-share" class="icon-only" fill="outline" aria-label="Share">
    <iconify-icon icon="mdi:share-variant" aria-hidden="true"></iconify-icon>
  </orb-button>
  <orb-tooltip for="tooltip-share" type="label">Share</orb-tooltip>
  <orb-button id="tooltip-delete" class="icon-only" fill="outline" aria-label="Delete">
    <iconify-icon icon="mdi:delete" aria-hidden="true"></iconify-icon>
  </orb-button>
  <orb-tooltip for="tooltip-delete" type="label">Delete</orb-tooltip>
</orb-stack>

Manual test:

  • Hover or Tab to each button. Its tooltip shows the name.
  • With a screen reader, each button is announced once by name, such as “Share, button”, with no description.

Placement

By default, a tooltip goes on whichever side of its trigger has the most room. Set placement to choose a side, such as top or bottom-start. If there isn’t room on that side, it flips to the opposite one. This is useful in toolbars, where a tooltip to the side would cover the neighboring buttons.

Top Above the button Bottom Below the button Right Beside the button
<orb-stack mode="row">
  <orb-button id="tooltip-top" fill="outline">Top</orb-button>
  <orb-tooltip for="tooltip-top" placement="top">Above the button</orb-tooltip>
  <orb-button id="tooltip-bottom" fill="outline">Bottom</orb-button>
  <orb-tooltip for="tooltip-bottom" placement="bottom">Below the button</orb-tooltip>
  <orb-button id="tooltip-right" fill="outline">Right</orb-button>
  <orb-tooltip for="tooltip-right" placement="right">Beside the button</orb-tooltip>
</orb-stack>

Manual test:

  • Hover each button. Its tooltip appears on the side named on the button.
  • Scroll so Top is at the very top of the window, then hover it. The tooltip flips below the button.

Properties

for

Description The target element of the tooltip
Attribute for
Type string
Default undefined
Required Yes

offsetX

Description Horizontal offset used when auto positioning the popover content
Attribute offset-x
Type number
Default 0

offsetY

Description Vertical offset used when auto positioning the popover content
Attribute offset-y
Type number
Default 10

placement

Description Where the tooltip should be placed. It flips to the opposite side when there isn’t room. Without it, the side with the most room is used.
Attribute placement
Type "bottom" | "bottom-end" | "bottom-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start"
Default undefined

timeout

Description Time in milliseconds to wait before showing the tooltip
Attribute timeout
Type number
Default 50

type

Description - description: The tooltip describes the trigger, which keeps its own name. Use it for extra information, such as “Saves a copy to your drive”. - label: The tooltip names the trigger. Use it for icon-only buttons, so the name isn’t announced twice. It replaces the trigger’s aria-label.
Attribute type
Type "description" | "label"
Default "description"

Dependencies

Used by

Graph

graph TD; orb-rich-text --> orb-tooltip style orb-tooltip fill:#f9f,stroke:#333,stroke-width:4px