JSFiddle - React, Tailwind, and code Playground

by Abdul Ahmad

HTML

<div ng-app='app' ng-controller='tooltips as tt'>
  <div class='tooltip-box' ng-repeat='item in tt.info'>
    <div class='text'>
      {{item.key1}}
    </div>

    <div class='tooltip under'>
      <div class='arrow'>

      </div>
      <div class='text'>
        {{item.key2}}
        {{item.key3}}
      </div>
    </div>
    <div class='tooltip-foreground'>
    </div>
  </div>
  <div>
  

  <div class='tooltip-box' ng-repeat='item in tt.info'>
    <div class='text'>
      {{item.key1}}
    </div>

    <div class='tooltip under'>
      <div class='arrow'>

      </div>
      <div class='text'>
        {{item.key2}}
        {{item.key3}}
      </div>
    </div>
    <div class='tooltip-foreground'>
    </div>
  </div>
  </div>
</div>

SCSS

.tooltip-box {
  
  display: inline-block;
  font-family: arial;
  position: relative;
  background-color: white;
  cursor: default;
  margin: 5px;
  
  .text {
    padding: 10px 20px;
  }
  .tooltip-foreground {
      position: absolute;
      left: 0;
      top: 100%;
      width: 100%;
      height: 100%;
      z-index: 5;
      transition: height 0.1s ease 0.2s;
  }
  .tooltip {
    
    /*
      opacity: 0;
    */
    transform: scale(0, 0);
    position: absolute;
    top: 100%;
    z-index: 4;
    left: 0;
    width: auto;
    text-align: center;
    transition: transform 0.2s ease 0.5s;
    padding-top: 5px;
    
    .text {
      width: auto;
      font-size: 12px;
      padding: 5px;
      background-color: tomato;
      color: white;
    }
    
  }
  .tooltip.under .arrow {
    width: 6px;
    height: 6px;
    margin: 0 auto;
    background-color: tomato;
    -webkit-transform: rotate(45deg);
    margin-bottom: -3px;
  }
}
.tooltip-box .text:hover ~.tooltip {
  transform: scale(1, 1);
  transition: transform 0.2s ease 0.5s;
}
.tooltip-box .text:hover ~.tooltip-foreground {
  height: 0;
  transition: height 0.1s ease;
}
.tooltip-box .tooltip:hover {
  transform: scale(1, 1);
  transition: transform 0.2s ease 0.5s;
}
.tooltip-box .tooltip:hover ~.tooltip-foreground {
  height: 0;
  transition: height 0.1s ease;
}

JavaScript

angular.module('app', [])
.controller('tooltips', tooltips);

function tooltips() {
	var self = this;
  self.info = [
  	{
    	"key1": 10,
      "key2": "second",
      "key3": 20
    },
    {
    	"key1": 24,
      "key2": "second",
      "key3": 64
    },
    {
    	"key1": 83,
      "key2": "second",
      "key3": 23
    },
    {
    	"key1": 84,
      "key2": "second",
      "key3": 45
    },
    {
    	"key1": 92,
      "key2": "second",
      "key3": 12
    }
  ];
}