PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Written By
Views

Quick use of Tooltips with Tippy.js

Quick use of Tooltips with Tippy.js

Hey there. Here is a quick tutorial to easily create tooltips using Tippy.js.

Add the main cdn to your scripts section:

<script src="https://unpkg.com/@popperjs/core@2"</script>
<script src="https://unpkg.com/tippy.js@6"></script>

Once Tippy is already loaded, then we'll execute this script:

<script>
    tippy('.js-tooltip')
</script>

This will create a Tooltip on all classes called js-tooltip.

So, we've created a generic class to easily create tooltips. Let's continue with the tooltip text.

We can use js-tooltip on every tag, and to set the tooltip we only have to write a special attribute:

data-tippy-content="Hello world"

Let's try with div and buttons

<button class="js-tooltip" data-tippy-content="Hello button">
  Hello, hover me
</button>

<span class="js-tooltip" data-tippy-content="Hello world">
  Hello, hover me
</span>

Finally, take a look at this Codepen and try it!

https://codepen.io/mgarcia96/pen/dyWwPvB

Thank you!

Marc

Comments (0)

loading comments