Tooltip

Shows a short label or an exact value next to the thing it describes.

Live React portVue source: WildTooltip.vueStorybook story: Feedback/TooltipReact component: WTooltip

Try it

Change the position to turn the arrow, and the tone to suit the surface underneath.

14 minutes ago
Position
Text
Tone
<WildTooltip
  text="14 minutes ago"
  position="top"
/>

When to use

  • Use a tooltip to name an icon button, or to give the exact value behind a rounded one.
  • Use it for the timestamp or unit a dense table had to drop.
Don’t use it
  • For anything people need to act. Touch screens can’t hover, so put it on the page.
  • For more than one line, or for a link. Use a popover.

Tones

Two, with the same size and arrow, so switching tone never moves the bubble.

Last reading 14 minutes ago
dark
Last reading 14 minutes ago
light
<WildTooltip text="14 minutes ago" />
<WildTooltip text="14 minutes ago" tone="light" />
  • Use dark by default. It stands out on white cards, grey rows and map tiles alike.
  • Use light on a dark or busy ground, such as a chart plot or a satellite map, where a dark bubble would sink into it.
  • Keep one tone per screen, so every tooltip on it reads as the same thing.

Positions

Four. The position is the side of the trigger the bubble sits on, and the arrow points back at it.

Last reading 14 minutes ago
top
Last reading 14 minutes ago
bottom
Last reading 14 minutes ago
left
Last reading 14 minutes ago
right
<WildTooltip text="Last reading 14 minutes ago" position="top">
  <WildIconButton icon="info" />
</WildTooltip>

Content

One line. A tooltip that wraps should have been a popover.

14 minutes ago
Soil moisture at 300 mm · 42.1%
Lead with the value, then its unit or time. Leave out the full stop.

Accessibility

Show it on keyboard focus as well as hover, and point the trigger’s aria-describedby at it. A screen reader then reads it after the trigger’s name.

KeyWhat it does
TabFocusing the trigger shows the tooltip.
EscapeHides it, and focus stays on the trigger.

Props

PropTypeDefaultDescription
textstring—The one line it shows.
position'top' | 'bottom' | 'left' | 'right''top'Which side of the trigger it sits.
tone'dark' | 'light''dark'See Tones.

Tokens

TokenValueWhere it lands
--global-neutral-grey-1300#0A090BDark ground.
--color-white#FFFFFFDark text; light ground.
--global-neutral-grey-1100#2D2B32Light text.
--global-neutral-grey-600#DCDCDELight border and arrow edges.
--shadow-dropdown0 4px 12px rgba(0,0,0,.08), …Both tones.
--radius-xs3pxCorner.
(no token)10px / 14px, 500Text size, line height and weight.