DEV Community

MD Taseen Khan
MD Taseen Khan

Posted on • Originally published at reactjsexample.com on

A customizable tooltip component for React applications

Get Tooltip React

A customizable tooltip component for React applications

A customizable tooltip component for React applications.

Installation

You can install the get-tooltip-react package using npm:

npm install get-tooltip-react
Enter fullscreen mode Exit fullscreen mode

Usage

Import the Tooltip component and use it in your React application:

import React from "react";
import { Tooltip } from "get-tooltip-react";
import "get-tooltip-react/dist/style.css"; // Don't forget to import the CSS for styling

function App() {
  return (
    <div className="App">
      <h1>Tooltip React Component</h1>

      <div className="container">
        <Tooltip
          tooltiptext="This is a tooltip!"
          position="top"
          bg="#172554"
          textColor="#93c5fd"
          delay={500}
          arrow
        >
          <button className="tooltip-btn">Hover Me</button>
        </Tooltip>

        <Tooltip tooltipText="Another tooltip">
          <span>Hover over me too!</span>
        </Tooltip>
      </div>
    </div>
  );
}

export default App;
Enter fullscreen mode Exit fullscreen mode

Props

The Tooltip component accepts the following props:

  • children: ReactNode (required) – The content that triggers the tooltip.
  • tooltiptext: string (required) – The text to display in the tooltip.
  • position: one of [“top”, “bottom”, “left”, “right”] – Position of the tooltip (default: “bottom”).
  • bg: string – Background color of the tooltip (default: “black”).
  • textColor: string – Text color of the tooltip (default: “white”).
  • delay: number – Delay before showing the tooltip (in milliseconds, default: 0).
  • arrow: boolean – Whether to show an arrow on the tooltip (default: false).

GitHub

View Github

Heroku

Tired of jumping between terminals, dashboards, and code?

Check out this demo showcasing how tools like Cursor can connect to Heroku through the MCP, letting you trigger actions like deployments, scaling, or provisioning—all without leaving your editor.

Learn More

Top comments (0)

Tiger Data image

🐯 🚀 Timescale is now TigerData: Building the Modern PostgreSQL for the Analytical and Agentic Era

We’ve quietly evolved from a time-series database into the modern PostgreSQL for today’s and tomorrow’s computing, built for performance, scale, and the agentic future.

So we’re changing our name: from Timescale to TigerData. Not to change who we are, but to reflect who we’ve become. TigerData is bold, fast, and built to power the next era of software.

Read more

👋 Kindness is contagious

Sign in to DEV to enjoy its full potential—unlock a customized interface with dark mode, personal reading preferences, and more.

Okay