How to create Tool tips using Materialize CSS

Hey, friend welcome come back to the site, if it's your first time then feel at home because you're in the right place.

In this simple post, I will be showing you how you can create or add simple tooltips on your SITE or WEB APP using materialize CSS.

Before we even go further, the live example is already infront of your eyes. Try hovering over those truncated article titles on your right handside(LEARN MORE SECTION) or at the bottom of the page(POSTS YOU MAY LIKE) if you are using a mobile device. Those are what we call the tooltips.

What are tooltips?

Tooltips are small, interactive, textual hints for mainly graphical elements.

How are they(tooltips) useful?

When using icons for actions you can use a tooltip to give people clarification on its function. For example delete button, Edit button, etc.

Watch Tutorial
How are they created?

You can create a tooltip by adding the .tooltipped class to your element. Moreso, there are different data attributes you can add on the element and specify it's position, that is to say, either on the top, bottom, left, right and this is set using the data-position attribute.

//data-position can be : bottom, top, left, or right
//data-tooltip defines the tooltip text you want to appear
  <a class="btn tooltipped" data-position="top" data-tooltip="I am a tooltip">Hover me!  </a>

But remember for any materialize CSS widget or component to work, you need to initialize;


//waits for the document to load before running the code inside
document.addEventListener('DOMContentLoaded', function() {

//Create a variable and assign it to any element with the tooltipped class.
	const hint_tip = document.querySelectorAll('.tooltipped');

//Then use the materialize instance(M) to initialize it.
	 M.Tooltip.init(hint_tip, {});


As you can see in the last line we passed in an object and this takes in key pair values(WATCH VIDEO TO UNDERSTAND THIS).

Or...Visit the official documentation page for the tooltips and learn more:

Related Post(s)

» How to create a Form Character Counter using Materialize

» How to create a Date Picker using Materialize css.

» How to create a simple Autocomplete Search Engine Using Materialize CSS

» How to create a Nav Bar Using Materialize CSS

» How to create a FAQ section using Materialize CSS Framework

collections_bookmark Category :: Materialize css
date_range Published :: 2 years ago At: 01:23 PM
event_note Detailed Date :: Aug 08th, 2019
person Writer :: Code
3 months ago

A JavaScript library for formatting and manipulating numbers - Numeral.js

Check out this lightweight JavaScript library used for formatting and manipulating numbers.

4 months ago

All Countries Drop Down List | HTML Select Country Name

This simple country dropdown list is freely available for you to copy and use in your project forms.

4 months ago

HTML Entities Code Alphabet Discovery Using JavaScript

In this post I will show how writing just a few lines in JavaScript will allow you to render, browse and discover the alphabetical letters using a set of HTML entity codes.

4 months ago


Download YTS YIFY movies using this simple project I created using their API.

4 months ago

Display Random Advice On Your Website or Web App Using Advice Slip JSON API

Here is a short project to display the use of APIs. I decided to work with an advice API because it seemed like a fun one that I haven't worked on before.

6 months ago

How do I get a YouTube video thumbnail from YouTube using PHP

Have you ever been on youtube and admired a thumbnail of a video?

8 months ago

How to recreate Facebook's console warning

When I was inspecting some code on Facebook. I came across this interesting feature. A simple styled console warning message from Facebook to its dear users(products).

11 months ago

How To Create A Stacked Gallery Using HTML And CSS Source Code

In this post I provide you with the source code for the youtube tutorial I made on how to create a Stacked image gallery Using HTML and CSS.