Components

Tooltips

A tooltip provides short, descriptive information when a user hovers or focuses on an element. It contains helpful but non-critical information and is useful in a space-constrained user interface.

Standard tooltip

The APR for the World Bank Platinum Credit Card is 9.7%

HTML code snippet

The APR for the World Bank Platinum Credit Card is 9.7% <span data-tooltip="relevant-tooltip"></span>

<template id="relevant-tooltip">
    <div class="tippy-heading">This data is accurate as of June 2023</div>
    <div class="tippy-body">
        APRs change over time and are specific to the applicant. Check rates before applying.
    </div>
</template>

<!--
Tooltips require a <template> element with an 'id' that matches the 'data-tooltip'
attribute of the tooltip's trigger element. The template can be anywhere on the page.

Additionally, the tooltip component must be imported independently of the rest of
the Design System using the namespace '@cfpb/cfpb-design-system/tooltips'.
For example, your project's JavaScript file might look like:

import {
  Expandable,
  ExpandableGroup,
  Summary,
  Multiselect,
} from '@cfpb/cfpb-design-system';
import { Tooltip } from '@cfpb/cfpb-design-system/tooltips';

Summary.init();
Expandable.init();
ExpandableGroup.init();
Multiselect.init();
Tooltip.init();

...rest of your code
-->

Latest Updates

Page last edited:
Show all details
Edit page