Tooltips in Webflow with tippy.js

Tutorial
June 5, 2024
3 min
Tippy.js Tooltip
Key points

Tooltips are an effective way to enhance the user experience (UX) of your website by providing contextual information without cluttering the user interface (UI).

In this article, we will show you how to easily add tooltips to your Webflow projects using tippy.js, a lightweight and powerful JavaScript library.

What is tippy.js?

tippy.js is a lightweight JavaScript library that allows you to create customizable tooltips. Built on Popper.js, it offers optimal performance and great flexibility. With tippy.js, you can easily add tooltips to your HTML elements and customize them according to your needs.

Why use tippy.js with Webflow?

In Webflow, there is no native way to create "true" tooltips. It is possible to create them from scratch, but it requires animation work.

However, to add tooltips within the tool, tippy.js is an excellent choice for several reasons:

  1. Easy integration: tippy.js is straightforward to integrate.
  2. Customization: You can customize the tooltips to maintain design consistency with your site.
  3. Performance: Lightweight and fast, tippy.js will not affect the loading speed of your pages.
  4. Flexibility: Compatible with various types of content and interactions.

Step-by-step: Adding tippy.js to your Webflow project

Follow these simple steps to integrate tippy.js into your Webflow project and start adding tooltips.

1. Include tippy.js in your Webflow project

First, you need to include the CSS and JavaScript files for tippy.js in your project. To do this, go to the page settings and scroll down to the Custom Code tab.

Add the CSS link and the JavaScript scripts in the Head Code and Footer Code sections, respectively:

<!-- Add this link in the Head Code section -->
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css">
<!-- Add these scripts in the Footer Code section -->
<script src="https://unpkg.com/@popperjs/core@2/dist/umd/popper.min.js"></script>
<script src="https://unpkg.com/tippy.js@6/dist/tippy-bundle.umd.js"></script>
Screenshot of the scripts and CSS tippy.js added to a Webflow page

2. Add tooltips to your elements

Now that tippy.js is included in your project, you can start adding tooltips to your HTML elements. For this, we will add the custom attribute data-tippy-content in the element settings.

For example, to add a tooltip to a button, follow these steps:

  1. Add a button to your page
  2. Select the button and go to its Settings.
  3. Scroll down to the custom attributes section
  4. Add a new attribute with data-tippy-content as the name and the tooltip text as the value.
Screenshot of a button in Webflow with the attribute [data-tippy-content="I am the text"]

Here is an example of a button with a tooltip; it has name: data-tippy-content and value: Free Live Webflow Training Every Thursday

3. Initialize tippy.js

To make the tooltips appear, you need to initialize tippy.js.

To do this, add the initialization script in the custom code (before body Tag) section of your Webflow page.

<script> tippy('[data-tippy-content]'); </script>
Initialization of the tippy.js script

4. Customize your tooltips

tippy.js offers a variety of customization options. You can configure the animation, theme, display delays, and much more.

Check out the tippy.js documentation to add advanced features to your tooltip and to match your design.

For example, here is a more customized button example below.

Custom Surprise 👀

Here are the custom attributes of this button:

  • data-tippy-followCursor="horizontal"
  • data-tippy-theme="digidop"
  • data-tippy-duration="300"

Here is the CSS code to create the "digidop" theme:

<style>
.tippy-box[data-theme~='digidop'] {
  background-color: #FCD33B;
  color: #101010;
}
.tippy-box[data-theme~='digidop'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: #FCD33B;
}
.tippy-box[data-theme~='digidop'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: #FCD33B;
}
.tippy-box[data-theme~='digidop'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: #FCD33B;
}
.tippy-box[data-theme~='digidop'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: #FCD33B;
}
</style>

Conclusion

By following these simple steps, you can easily add stylish and customized tooltips to your Webflow projects using tippy.js. Not only does this enhance the user experience, but it also adds a professional touch to your site.

Feel free to further explore the options in tippy.js to make the most of this powerful library.

Discover other useful JavaScript libraries:

Thibaut Legrand
Thibaut Legrand
Technical Solutions Architect & Webflow Expert

Suggested articles

Webflow Localization, Credial's Use Case
Documentation
Webflow

Webflow Localization: Practical Guide & Credial's Use Case

Webflow Localization: Practical Guide & Credial's Use Case
Visuel showcasing digidop.fr switching to digidop.com
News
Digidop

Digidop.fr is now Digidop.com

Digidop.fr is now Digidop.com
Photo of the Digidop team with the Digidop Logo 2024
News
Digidop

A Look Back at an Exceptional 2024 and Vision 2025

A Look Back at an Exceptional 2024 and Vision 2025

Want to turn your website into your most valuable asset?

Contact us today