All Projects → kazzkiq → Balloon.css

kazzkiq / Balloon.css

Licence: mit
Simple tooltips made of pure CSS

Programming Languages

CSS
56736 projects
SCSS
7915 projects
HTML
75241 projects

Projects that are alternatives of or similar to Balloon.css

Style Resources Loader
CSS processor resources loader for webpack
Stars: ✭ 214 (-95.59%)
Mutual labels:  sass, less
Reset Css
An unmodified* copy of Eric Meyer's CSS reset. PostCSS, webpack, Sass, and Less friendly.
Stars: ✭ 244 (-94.97%)
Mutual labels:  sass, less
Kit
ReactQL starter kit (use the CLI)
Stars: ✭ 232 (-95.22%)
Mutual labels:  sass, less
Compile Hero
🔰Visual Studio Code Extension For Compiling Language
Stars: ✭ 169 (-96.52%)
Mutual labels:  sass, less
Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (-94.64%)
Mutual labels:  sass, less
Yarsk
Don't use this, use Create React App
Stars: ✭ 199 (-95.9%)
Mutual labels:  sass, less
Prejss
Get the power of PostCSS with plugins in your JSS styles. 🎨 Just put CSS into JS and get it as JSS object.
Stars: ✭ 238 (-95.09%)
Mutual labels:  sass, less
Kirby Webpack
💪 A Kirby CMS starter-kit with modern frontend tools
Stars: ✭ 150 (-96.91%)
Mutual labels:  sass, less
Wenk
😉 Lightweight pure CSS tooltip for the greater good
Stars: ✭ 694 (-85.69%)
Mutual labels:  tooltip, less
Material Colors
Colors of Google's Material Design made available to coders
Stars: ✭ 252 (-94.81%)
Mutual labels:  sass, less
Style Resources Module
Nobody likes extra @import statements!
Stars: ✭ 485 (-90%)
Mutual labels:  sass, less
Madge
Create graphs from your CommonJS, AMD or ES6 module dependencies
Stars: ✭ 5,635 (+16.16%)
Mutual labels:  sass, less
Webpack Encore
A simple but powerful API for processing & compiling assets built around Webpack
Stars: ✭ 1,975 (-59.29%)
Mutual labels:  sass, less
React Native Css Modules
Style React Native components using CSS, PostCSS, Sass, Less or Stylus.
Stars: ✭ 207 (-95.73%)
Mutual labels:  sass, less
Reactql
Universal React+GraphQL starter kit: React 16, Apollo 2, MobX, Emotion, Webpack 4, GraphQL Code Generator, React Router 4, PostCSS, SSR
Stars: ✭ 1,833 (-62.21%)
Mutual labels:  sass, less
Vbuild
"Compile" your VueJS components (sfc/*.vue) to standalone html/js/css ... python only (no need of nodejs). Support python components too !
Stars: ✭ 236 (-95.14%)
Mutual labels:  sass, less
Gulp Starter Kit
A simple Gulp 4 Starter Kit for modern web development.
Stars: ✭ 134 (-97.24%)
Mutual labels:  sass, less
Glup
Some of the gulp tutorial -《gulp笔记》
Stars: ✭ 136 (-97.2%)
Mutual labels:  sass, less
A Journey Toward Better Style
A Journey toward better style
Stars: ✭ 245 (-94.95%)
Mutual labels:  sass, less
Fontisto
The iconic font and CSS toolkit. Fontisto gives you scalable vector icons that can instantly be customized: size, color, drop shadow and anything that can be done with the power of CSS.
Stars: ✭ 413 (-91.49%)
Mutual labels:  sass, less

npm version


Balloon.css: Simple tooltips made of pure CSS.

Simple tooltips made of pure CSS

Balloon.css lets you add tooltips to elements without JavaScript and in just a few lines of CSS.

It weights ~1.1kb minified (Brotli).

Demo & Playground

You can play with Balloon.css here: https://jsfiddle.net/kuzmd942/

You also can check more examples at the website: https://kazzkiq.github.io/balloon.css/

Usage

Installation

Using npm:

npm install balloon-css

You can then import the CSS file directly into your JS (using Webpack, etc):

// Your index.js file, etc.
import 'balloon-css';

or import the source file if using SASS/SCSS:

/* Your main.scss file, etc. */
@import "~balloon-css/src/balloon"

CDN version:

If you don't want to use npm, there is a CDN option:

<!-- This link will always fetch the latest version of Balloon.css -->
<link rel="stylesheet" href="https://unpkg.com/balloon-css/balloon.min.css">

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

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

Positioning

For positioning, use data-balloon-pos attribute with one of the values: up, down, left, right, up-left, up-right, down-left or down-right:

<button aria-label="Whats up!" data-balloon-pos="up">Hover me!</button>
<button aria-label="Whats up!" data-balloon-pos="left">Hover me!</button>
<button aria-label="Whats up!" data-balloon-pos="right">Hover me!</button>
<button aria-label="Whats up!" data-balloon-pos="down">Hover me!</button>

<button aria-label="Whats up!" data-balloon-pos="up-left">Hover me!</button>
<button aria-label="Whats up!" data-balloon-pos="up-right">Hover me!</button>
<button aria-label="Whats up!" data-balloon-pos="down-left">Hover me!</button>
<button aria-label="Whats up!" data-balloon-pos="down-right">Hover me!</button>

Showing tooltips programatically

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

<button aria-label="Whats up!" data-balloon-pos="up" id="show-tip">Hover me!</button>
<script>
  const btn = document.getElementById('show-tip')
  btn.setAttribute('data-balloon-visible', '')
</script>

Disabling animation

If for some reason you do not want animations in your tooltips, you can use the data-balloon-blunt attribute for that.

<button data-balloon-blunt aria-label="No animation!" data-balloon-pos="up">No animation!</button>

Customizing Tooltips

Balloon.css exposes CSS variables to make it easier to customize tooltips:

  • --balloon-border-radius
  • --balloon-color
  • --balloon-font-size
  • --balloon-move

This way, you can use custom CSS to make your own tooltip styles:

/* Add this to your CSS */
.tooltip-red {
  --balloon-color: red;
}

.tooltip-big-text {
  --balloon-font-size: 20px;
}

.tooltip-slide {
  --balloon-move: 30px;
}

If you want to customize tooltips globally, use the :root selector:

/* All tooltips would now be square and blue */
:root {
  --balloon-border-radius: 0;
  --balloon-color: blue;
}

Glyphs and Icon Fonts

You can also add any HTML special character to your tooltips, or even use third-party Icon fonts:

<button aria-label="HTML special characters: &#9787; &#9986; &#9820;" data-balloon-pos="up">Hover me!</button>
<button aria-label="Emojis: 😀 😬 😁 😂 😃 😄 😅 😆" data-balloon-pos="up">Hover me!</button>

Example using Font Awesome:

<button class="fa" aria-label="Font Awesome: &#xf030; &#xf133; &#xf1fc; &#xf03e; &#xf1f8;" data-balloon-pos="up">Hover me!</button>

Contributing

Balloon.css is mantained in SASS and LESS. To contribute with bugfixes and enchancements you must follow this steps:

  1. Clone repo. E.g. git clone https://github.com/kazzkiq/balloon.css.git
  2. Run npm install
  3. Edit SASS file and run npm run build to generate the production CSS files.
  4. Make sure to test the production files over the website (branch gh-pages) before submitting a Pull Request.

Note 1: Remember to update the SASS file instead of the generated ones (balloon.css and balloon.min.css are generated on every build from SASS file).

Credits

Made by Claudio Holanda (@kazzkiq)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].