Tooltip

Tooltips are the helpful whispers in your interface. They provide context, explanations, and guidance without cluttering your design.

Preview
Code

Installation

First, make sure you have the required dependencies:

npx @rajdevxd/aura-ui add tooltip
yarn @rajdevxd/aura-ui add tooltip
pnpm dlx @rajdevxd/aura-ui add tooltip
bunx --bun @rajdevxd/aura-ui add tooltip

Usage

Here's how to add helpful tooltips:

import { Tooltip } from "@/components/ui/tooltip"

const MyComponent = () => {
  return (
    <div className="space-x-4">
      <Tooltip content="This is a helpful tip!" position="top">
        <button>Hover me</button>
      </Tooltip>

      <Tooltip content="Information on the right" position="right">
        <span>ℹ️</span>
      </Tooltip>
    </div>
  )
}

Props

PropTypeRequiredDescription
contentstringYesThe tooltip text to display
childrenReact.ReactNodeYesThe element that triggers the tooltip
position"top" | "bottom" | "left" | "right"NoTooltip position relative to trigger
classNamestringNoAdditional CSS classes for the tooltip

Features

  • Multiple Positions: Top, bottom, left, and right positioning
  • Auto-positioning: Smart positioning to stay within viewport
  • Hover Trigger: Shows on mouse hover, hides on mouse leave
  • Customizable Styling: Easy to match your design system

Common Issues

  1. "Tooltip not showing!" - Make sure you're hovering over the trigger element
  2. "Wrong position!" - Check the position prop and available space
  3. "Styling conflicts!" - Ensure your CSS doesn't interfere with tooltip positioning

Contributing

Tooltips enhance UX significantly! Help us improve their positioning and accessibility.

Tooltips - because sometimes users need a little extra help! 💡