PU-Tooltip Component

Customizable tooltip component with precise positioning and directional arrows

Top
Top Left
Top Right
Bottom
Bottom Left
Bottom Right
Left
Left Top
Left Bottom
Right
Right Top
Right Bottom
PropTypeRequiredDefaultDescription
positionsArray<Position>Yes-Array of arrow positions (see Position Types)
PositionDescriptionCSS Rotation
topTop-center arrow-135deg
top-leftTop-left aligned arrow-135deg
top-rightTop-right aligned arrow-135deg
bottomBottom-center arrow45deg
bottom-leftBottom-left aligned arrow45deg
bottom-rightBottom-right aligned arrow45deg
leftLeft-center arrow135deg
left-topLeft-top aligned arrow135deg
left-bottomLeft-bottom aligned arrow135deg
rightRight-center arrow-45deg
right-topRight-top aligned arrow-45deg
right-bottomRight-bottom aligned arrow-45deg
  • Base styling with Tailwind:
    .pu-tooltip {
      @apply relative border-2 border-primary-light-500 bg-white 
            rounded-lg text-center p-4 shadow-lg shadow-primary-light-500/20;
    }
    
    .tooltip-arrow {
      @apply absolute w-6 h-6 bg-white transform z-10 rounded-sm;
      border: 2px solid inherit;
    }
    

Arrow Positioning System

  • Dynamic CSS transforms based on position
  • Precision placement using Tailwind spacing utilities
  • Inherits border color from parent container

CSS Clip-Path Technique

.tooltip-arrow::before {
  content: '';
  clip-path: polygon(0% 0%, 100% 0%, 50% 50%);
  @apply absolute w-[39px] h-[39px] bg-white rotate-[135deg];
}
PropTypeDescription
typeTooltipPositionSpecific position variant to display
type TooltipPosition = 
  | 'top' | 'top-left' | 'top-right'
  | 'bottom' | 'bottom-left' | 'bottom-right'
  | 'left' | 'left-top' | 'left-bottom'
  | 'right' | 'right-top' | 'right-bottom'