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-tt

v1.1.12

Published

minimal, responsive, React tooltip component

Downloads

32

Readme

react-tt

no-fuss React tooltips

About

I didn't especially like any of the React tooltip libraries I found out there; either they didn't fit my use-case, they were too big, or they plain didn't work. react-tt is tiny (~6KB prod-minified), it won't screw up your layout with extra elements, and it tries hard to ensure all tooltip contents fit inside the viewport.

Getting Started

$ npm install --save react-tt

Usage

import/require the module in your usual way:

import Tooltip from 'react-tt';

and instantiate using <Tooltip> (in JSX) or React.createElement(Tooltip) (in vanilla JS). Not much to it.

Here's a simple example in ES6:

import Tooltip from 'react-tt';

function HelloComponent(props) {
  return (
    <div>
      <Tooltip>
        <span>
          hello
        </span>
      </Tooltip>
      <span>
        hover over me
      </span>
    </div>
  );
}

export default MyComponent

for live examples, clone this repository and run npm run example then visit localhost:8080 or just go to https://orzechowskid.github.io/react-tt/ .

API

Tooltip

React.createElement(Tooltip, props, children)

creates a new Tooltip component with the given props and, optionally, some children.

props.backgroundColor: PropTypes.string

specifies the background color for the tooltip. Valid values are anything accepted by CSS:

  • color names like red or salmon
  • hex strings like #f8f8f8
  • rgb or rgba strings like rgba(255, 255, 255, 0.5)
  • hsl strings like hsl(214, 82%, 51%)

props.id: PropTypes.string.isRequired

specifies the id of the tooltip.

props.location: PropTypes.oneOf([ 'bottom', 'top' ])

specifies the orientation of the tooltip relative to its container. Defaults to top.

props.spacing: PropTypes.number

specifies the spacing between the tooltip's indicator and its container. Defaults to 14 (px).

props.sticky: PropTypes.bool

specifies the tooltip to always be shown. Defaults to false.

props.zIndex: PropTypes.number

specifies the tooltip's z-index. Defaults to 0.

Development

$ git clone https://www.github.com/orzechowskid/react-tt.git
$ npm install
$ cd src
[ ... edit edit edit ... ]
$ npm run example
$ open http://localhost:8808
[ ... verify verify verify ... ]
$ npm run build:prod

Testing

npm run test should run the test suite. please update it if you add features.