Skip to main content

Style Presets

Content

Position & Alignment

Colors

Sizing

Arrow

Animation

Effects

Live Preview

Hover the trigger in the preview
Hover me
This is a tooltip!

Generated CSS

.tooltip-trigger {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.tooltip {
  position: absolute;
  bottom: 100%;
  margin-bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  max-width: 200px;
  width: max-content;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
  transition-delay: 0ms;
}

.tooltip-trigger:hover .tooltip,
.tooltip-trigger:focus .tooltip {
  visibility: visible;
  opacity: 1;
  transition-delay: 0ms;
}

.tooltip::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  bottom: -6px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1f2937;
  left: 50%;
}

Generated HTML

<span class="tooltip-trigger" tabindex="0">
  Hover me
  <span class="tooltip">This is a tooltip!</span>
</span>

Tooltip Best Practices

Accessibility

  • Use tabindex="0" for keyboard focus
  • Add role="tooltip" for screen readers
  • Use aria-describedby on trigger
  • Ensure sufficient color contrast

Content

  • Keep tooltip text concise and helpful
  • Avoid putting essential info in tooltips
  • Don't use tooltips for errors or actions
  • Provide context, not just labels

Positioning

  • Avoid covering related UI elements
  • Consider viewport boundaries
  • Use appropriate delay for hover
  • Don't block the trigger element

Mobile

  • Tooltips are less effective on touch
  • Consider alternative patterns for mobile
  • Use click/tap triggers if needed
  • Make touch targets large enough

Need Custom Tooltip Components?

Our team can build interactive tooltips with JavaScript functionality, smart positioning, and framework integration.

Work With Us