Skip to main content
Tooltip
@coinbase/cds-web@8.56.1
A component that displays additional information on hover.
import { Tooltip } from '@coinbase/cds-web/overlays/Tooltip'
Peer dependencies
  • framer-motion: ^10.18.0,
  • react-dom: ^18.3.1
Related components
Default color inversion

Tooltip surfaces automatically flip the active color scheme (via invertColorScheme, which defaults to true) so the overlay background has high contrast against the surrounding UI. Set invertColorScheme={false} on either the web or mobile Tooltip if you need the content to inherit the current theme and ensure your custom colors still meet contrast guidelines.

Placement

Loading...

Positioning

Sometimes you may want to use a tooltip with an absolute positioned element.

To ensure the tooltip is properly aligned, you should instead set the position prop on the tooltip.

Loading...

Opt out of color inversion

Tooltips invert the current color scheme by default. Pass invertColorScheme={false} to keep the tooltip aligned with the surrounding surface and supply your preferred elevation/background tokens.

Loading...

Tooltip in TextInput

You can use tooltips within TextInput to provide more context.

Loading...

Visibility delay (hover)

Use openDelay and closeDelay to slow down hover activation and reduce accidental opens on dense UI. Keyboard focus still opens immediately.

Loading...

Accessibility (A11y)

When tooltip content is non-interactive (text only), focus stays on the trigger and the tooltip is rendered in a portal. When tooltip content has interactive elements (links, buttons), set hasInteractiveContent={true} so the tooltip stays in the document flow and keyboard users can tab into the content. This sets disablePortal, disableAutoFocus, and disableFocusTrap appropriately.

Tooltip on an icon (or other non-button anchor):

When using an Icon (or other non-<button> element) as the tooltip trigger, add role="button" and tabIndex={0} so screen readers (e.g. VoiceOver) can discover it with arrow keys and announce the tooltip. If the icon performs an action on click, use IconButton instead so the trigger is a real <button>.

Example: tooltip on an icon (string content)

Loading...

Example: tooltip on an icon (React node content)

Loading...

When tooltip content is interactive (links, buttons):

  • Prefer Modal or another pattern for actionable content when possible. Tooltips are intended for short, non-interactive descriptions.
  • If you must use interactive content inside a tooltip, set hasInteractiveContent={true} so the content stays in the document flow. The prop allows keyboard users to tab into the tooltip, through its content, and out to the next focusable element on the page. With the default portal, focus behavior can be inconsistent when moving between trigger and content.

Example: tooltip with interactive content

Loading...

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.