Tooltip using only CSS and very low build size.

Overview

css-only-tooltip

A very lightweight tooltip utitlity library, made using only CSS with dynamic light and dark themes.

Node.js Package NPM downloads License minified size npm version Css language share

Alt Text

Insatallation

  • Using npm
    $ npm install css-only-tooltip

  • Using yarn
    $ yarn add css-only-tooltip

  • Using jsDelivr CDN

     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/css-only-tooltip@latest/dist/styles.min.css">
  • Using unpkg CDN:

     <link rel="stylesheet" href="https://unpkg.com/css-only-tooltip@latest/dist/styles.min.css">

Quick start

css-only-tooltip uses only data html attribute for working. So, the only step is to import the CSS in your file and use it.

When using CDN:-

Add the CDN link in your HTML file inside the <head> tag. And then pass the tooltip text in format:

<!DOCTYPE  html>
 <head>
   <!-- Add the CDN link -->
   <link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/styles.min.css">
</head>

<body>
   <div class="container">
     <p data-css-only-tooltip="Tooltip 1">Text</p>
   </div>
</body>
</html>

When using Package Manger (NPM/Yarn):-

Import the styleSheet into the main root level component of the App. (for eg. in App.js in React App)

import 'css-only-tooltip/dist/styles.min.css';

Now, add the text in the data attribute in the child components.

<span data-css-only-tooltip="Hello from tooltip">Hover on me to see the tooltip</span>

Customization

There are customization options provided.
Provide the customization options in a space seperated string in the data attribute like this:-

<p data-css-only-props="customization options">

Options:

Thre are some optional customization options are available.

  • Positions:

    There are four positions provided. Bottom is default option.

    • top
    • right
    • bottom
    • left
  • Themes:

    This supports the user device's theme dynamically. There's no need to specify theme spereately. Beside this, there are two theme options provided for customization. light is default option.

    • dark
    • light

Option Values default Required
Position top, right, bottom, left bottom No
Theme light, dark light No

Examples:

  • dark theme, right side.
    <span 
      data-css-only-tooltip="Tooltip 2 bottom" 
      data-css-only-tooltip-props="light bottom">
       Dakr tooltip on right side
    </span>

Play with it live:-
Edit css-only-tooltip-Demo

You might also like...

A simple step by step tooltip helper for any site

A simple step by step tooltip helper for any site

Tooltip Sequence A minimalistic set of tooltips on your app. What it does So suppose you create a Web Application and you want to take your users or a

Dec 21, 2022

The JavaScript library let’s you transform native tooltip’s into customizable overlays.

iTooltip The JavaScript library let’s you transform native tooltip’s into customizable overlays. Use: script src="/path/to/iTooltip.js"/script sc

Dec 17, 2021

Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp.

Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp.

lqip-modern Modern approach to Low Quality Image Placeholders (LQIP) using webp and sharp. (demo) This approach is extremely fast and produces much sm

Dec 30, 2022

In this project I have build a To Do List app that you can list, add, delete and manage your daily tasks better. Build with HTML, CSS, JS, ES6, JSON

ToDo List This project is build by javascript web packages which can add and remove daily tasks. Built With Html Css Javascript Sublime Text Author 👤

Oct 25, 2022

advanced calculator using only HTML, CSS and JS

Welcome to GitHub Pages You can use the editor on GitHub to maintain and preview the content for your website in Markdown files. Whenever you commit t

May 14, 2022

jQuery based scrolling Bar, for PC and Smartphones (touch events). It is modern slim, easy to integrate, easy to use. Tested on Firefox/Chrome/Maxthon/iPhone/Android. Very light 7ko min.js and 1Ko min.css.

Nice-Scrollbar Responsive jQuery based scrolling Bar, for PC and Smartphones (touch events). It is modern slim, easy to integrate, easy to use. Tested

Jan 18, 2022

Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

Dec 23, 2022

Group and sort Eleventy’s verbose output by directory (and show file size with benchmarks)

Group and sort Eleventy’s verbose output by directory (and show file size with benchmarks)

eleventy-plugin-directory-output Group and sort Eleventy’s verbose output by directory (and show file size with benchmarks). Sample output from eleven

Oct 27, 2022

A low-feature, dependency-free and performant test runner inspired by Rust and Deno

minitest A low-feature, dependency-free and performant test runner inspired by Rust and Deno Simplicity: Use the mt test runner with the test function

Nov 12, 2022
Comments
  • light theme not working on users having dark theme enabled

    light theme not working on users having dark theme enabled

    light theme is not working when the theme value is passed through data-css-only-props="light".

    <span
    	data-css-only-tooltip="test message"
    	data-css-only-tooltip-props="light top"
    	>Test</span
    >
    

    with this code, a tooltip with the light theme is expected on all devices but getting dark theme tooltip on dark users who has enabled dark theme on devices.

    opened by thoughtlessmind 0
Releases(v1.1.2)
Owner
Rajiv
Frontend Engineer
Rajiv
A very simple image slider that will responsively work with images of any size or shape

Square1 A very simple image slider that will responsively work with images of any size or shape. requires jQuery Demo Installation Link to jQuery <sc

Thom 9 May 20, 2022
A (very) minimalist creative coding playground. Make animations using only 64 HTML sliders!

Sliderland A (very) minimalist creative coding playground. Make animations using only 64 HTML sliders! Credits The recording feature uses ffmpeg.wasm

null 181 Dec 30, 2022
An exercise in building a very minimal (and very stupid) in-memory SQL-like database for educational purposes.

Stupid Database This is an exercise in building a very minimal (and very stupid) in-memory SQL-like database for educational purposes. None of this co

Fabio Akita 196 Dec 20, 2022
A Very Good Documentation Site created by the Very Good Ventures Team 🦄

Very Good Docs Site Developed with ?? by Very Good Ventures ?? A Very Good Docs Site created by the Very Good Ventures Team. Generated by the Very Goo

Very Good Open Source 8 Nov 2, 2022
Simple pure CSS ToolTip

PureCSSToolTip Simple pure CSS ToolTip purecsstooltip.css is used to the added tooltip for a web app, web page without javascript. This full of CSS co

Gokul S 3 Sep 19, 2022
ToolJet an open-source low-code framework to build and deploy internal tools quickly without much effort from the engineering teams

ToolJet is an open-source low-code framework to build and deploy internal tools quickly without much effort from the engineering teams. You can connect to your data sources, such as databases (like PostgreSQL, MongoDB, Elasticsearch, etc), API endpoints (ToolJet supports importing OpenAPI spec & OAuth2 authorization), and external services (like Stripe, Slack, Google Sheets, Airtable) and use our pre-built UI widgets to build internal tools.

ToolJet 15.6k Jan 3, 2023
Bitloops is Low-Code Workflow Orchestration platform that helps you build backend systems and APIs 10x faster.

Bitloops Bitloops is a scalable open source Firebase substitute that can support any database and workflow orchestration. We’re building Bitloops usin

Bitloops 21 Aug 9, 2022
🌈 GitHub following, followers, only-following, only-follower tracker 🌈

github-following-tracker GitHub following, followers, only-following, only-follower tracker ?? Just enter your GitHub name and track your followings!

Youngkwon Kim 10 Jun 15, 2022
A lightweight tooltip plug-in library

popper-next 是一款轻量的 Tooltip 插件 vue、react安装使用 推荐yarn yarn add popper-next 或者 cnpm install popper-next -S 在html页面中如何使用 <script src="https://unpkg.com/pop

east-wzd 4 Dec 7, 2022
A basic Svelte tooltip directive.

SVooltip A basic Svelte tooltip directive. Powered by Floating UI. Usage <script> import { tooltip } from 'svooltip'; import 'svooltip/svooltip.css'

Ian 28 Nov 26, 2022