Tooltip

A hand-drawn tooltip that reveals a short hint on hover or focus.

Overview

A Tooltip reveals a short, supplementary hint about the element it wraps. It is not for essential information — content must remain usable without ever seeing the tooltip.

Anatomy

A sketchy bubble (@ghds/sketch-core) positioned near a single trigger element and linked to it via aria-describedby. On the web it appears on hover (after a short delay) or focus and hides on leave, blur, or Escape; positioned with floating-ui.

Variants & States

State Status Notes
Hidden Implemented Default.
Shown Implemented On hover (after delay) or focus (web); on tap (React Native).
Disabled Not implemented

Usage

Do

  • Keep tooltip text short — a few words.
  • Attach it to a focusable trigger so keyboard and screen-reader users can reveal it.
  • Use it for supplementary hints only.

Don't

  • Don't put essential information or interactive controls in a tooltip.
  • Don't wrap a non-focusable element — the tooltip would be unreachable by keyboard.

Accessibility

Content

A short phrase. Long text is capped to a readable max width; keep it concise.

Props API

React@ghds/react

PropTypeDefaultDescription
contentReactNodeTooltip content.
childrenReactElementThe single trigger element.
delaynumber300Hover show delay (ms).

Web Components@ghds/web-components

PropTypeDefaultDescription
contentstringTooltip text.
delaynumber300Hover show delay (ms).
(slot)elementThe trigger element goes in the default slot.

React Native@ghds/react-native

PropTypeDefaultDescription
contentstringTooltip text (also the trigger accessibility hint).
childrenReactNodeThe trigger element.
testIDstringTest handle for queries.

Code examples

// React — @ghds/react (hover or focus the trigger)
import { Button } from '@ghds/react/button';
import { Tooltip } from '@ghds/react/tooltip';

<Tooltip content="Saves your changes">
  <Button>Save</Button>
</Tooltip>;
<!-- Web Components — @ghds/web-components (trigger goes in the default slot) -->
<script type="module">
  import '@ghds/web-components/button';
  import '@ghds/web-components/tooltip';
</script>
<gh-tooltip content="Saves your changes">
  <gh-button>Save</gh-button>
</gh-tooltip>
// React Native — @ghds/react-native (tap to toggle)
import { Button } from '@ghds/react-native/button';
import { Tooltip } from '@ghds/react-native/tooltip';

<Tooltip content="Saves your changes">
  <Button label="Save" onPress={save} />
</Tooltip>;

Live Demo

React @ghds/react

Web Components @ghds/web-components

Save