Coder Social home page Coder Social logo

vishnubaliga / spiketip Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 3.0 78 KB

Create effortless tooltips that breathe CSS! No Javascript. Just the good old CSS.

Home Page: https://vishnubaliga.github.io/SpikeTip/

License: MIT License

CSS 57.96% HTML 27.36% SCSS 14.67%
tooltip tooltips css-tooltip css-tooltips pure-css pure-css3 tooltip-library tooltip-custom-element

spiketip's Introduction

SpikeTip Tooltip

npm version

Sleek tooltips spun from CSS

Javascript? Nah. Create effortless tooltips that breathe CSS! No Javascript. Just the good old CSS.

Demo & Playground

You can check more exaples at the website: https://spiketip.netlify.app

You can play with SpikeTip here: https://jsfiddle.net/Baliga/v72fyh6z/

Usage

Installation

Using npm: (prerequisites: css-loader, style-loader)

npm install spiketip-tooltip
import 'spiketip-tooltip/spiketip.min.css'

Manually: Simply download spiketip.min.css from this repo and add it to your HTML. e.g.

<link rel="stylesheet" href="path/to/spiketip.min.css">

Alternatively, you can use it via CDN (provided by jsdelivr):

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/spiketip.min.css">

Positioning

For positioning, use spiketip-pos attribute with one of the values: top, bottom, left, right, top-left, top-right, bottom-left or bottom-right:

<button spiketip-title="Whats up!" spiketip-pos="top">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="left">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="right">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom">Hover me!</button>

<button spiketip-title="Whats up!" spiketip-pos="top-left">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="top-right">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom-left">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom-right">Hover me!</button>

Color Options

For positioning, use spiketip-color attribute with one of the values: success, error, warning, info:

<button spiketip-title="Whats up!" spiketip-pos="top" spiketip-color="success">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="left" spiketip-color="error">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="right" spiketip-color="warning">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom" spiketip-color="info">Hover me!</button>

<button spiketip-title="Whats up!" spiketip-pos="top-left" spiketip-color="warning">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="top-right" spiketip-color="info">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom-left" spiketip-color="success">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom-right" spiketip-color="error">Hover me!</button>

Size

For sizing, use spiketip-length attribute with one of the values: sm, md, lg, xl, auto:

<button spiketip-title="Whats up!" spiketip-pos="top" spiketip-length="sm">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="left" spiketip-length="md">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="right" spiketip-length="lg">Hover me!</button>
<button spiketip-title="Whats up!" spiketip-pos="bottom" spiketip-length="xl">Hover me!</button> 
<button spiketip-title="Whats up!" spiketip-pos="bottom" spiketip-length="auto">Hover me!</button> 

Showing tooltips programatically

If you want to show tooltips even when user interaction isn't happening, you can simply use the spiketip-visible attribute:

<button spiketip="Whats up!" spiketip-pos="up" id="tooltip-element">Hover me!</button>
<script>
  const btn = document.getElementById('tooltip-element')
  btn.setAttribute('spiketip-visible', '')
</script>

Credits

Developed with โค by Vishnu_Baliga

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.