npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-tailwind-tooltip

v1.0.4

Published

React tailwind tooltip is a React component for creating customizable tooltips using Tailwind CSS. It provides flexibility in tooltip placement, appearance, and behavior, making it easy to enhance user interfaces with informative tooltips.

Downloads

66

Readme

React tailwind tooltip

React tailwind tooltip is a React component for creating customizable tooltips using Tailwind CSS. It provides flexibility in tooltip placement, appearance, and behavior, making it easy to enhance user interfaces with informative tooltips.

TypeScript React TailwindCSS DaisyUI

PNPM Licence

Installation:

NPM

Install with npm:

npm install react-tailwind-tooltip

Install with yarn:

yarn add react-tailwind-tooltip

Install with pnpm:

pnpm add react-tailwind-tooltip

License

This project is licensed under the MIT License - see the LICENSE file for details.

Repository

For more information, issues, and contributions, visit the GitHub repository.

Preview

Open this example in StackBlitz:

Open in StackBlitz

Example Usage:

Example

import React from 'react';
import { Tooltip } from 'react-tailwind-tooltip';

const App = () => {
  return (
    <div className="p-6">
      <Tooltip title="This is a tooltip!" placement="top" arrow>
        <button className="px-4 py-2 bg-blue-500 text-white rounded">Hover me</button>
      </Tooltip>
    </div>
  );
};

export default App;

Tailwind Configuration

In your tailwind.config.(js|ts):

module.exports = {
  content: [
    './src/**/*.{js,jsx,ts,tsx}',
    './node_modules/react-tailwind-tooltip/**/*.{ts,tsx,js,jsx}',
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};

Monorepo Setup

If you’re working in a monorepo with workspaces, you may need to use require.resolve to ensure Tailwind can see your content files:

In tailwind.config.(js|ts):

const path = require('path');

module.exports = {
  content: [
    './components/**/*.{html,js}',
    './pages/**/*.{html,js}',
    path.join(path.dirname(require.resolve('react-tailwind-tooltip')), '**/*.{ts,tsx,js,jsx}'),
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};

Properties

| Name | Type | Description | | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | | children | React.ReactNode | The element that the tooltip will be attached to. | | title | React.ReactNode | The content of the tooltip. | | placement* | top \| top-start \| top-end \| bottom \| bottom-start \| bottom-end \| left \| left-start \| left-end \| right \| right-start \| right-end | TThe preferred position of the tooltip. Default bottom | | followCursor* | boolean | Whether the tooltip should follow the cursor. Default false | | arrow* | boolean | Whether to display an arrow pointing to the element. Default false | | open* | boolean | Control the visibility of the tooltip. | | tooltipStyle* | string | Style of the tooltip. Default bg-[#223354]/95 text-white text-sm | | arrowStyle* | string | Style of the arrow. Default to-[#223354]/95 | | enterDelay* | number | Delay in milliseconds before the tooltip appears. Default 100 | | leaveDelay* | number | Delay in milliseconds before the tooltip disappears. Default 100 | | onOpen* | (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void | Callback function triggered when the tooltip opens. | | onClose* | (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void | Callback function triggered when the tooltip closes. |

Props marked with * are not required.