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-responsive-tooltip

v1.0.0

Published

A react responsive tooltip component

Downloads

54

Readme

A React responsive and customizable tooltip component

Works on desktop and touch device. Displayed on touch on touch device, hidden when any part of the page is touched again

Basic Usage

The tooltip has a default style and a default positionning configuration

<ToolTip>
  My fabulous tooltip content
</ToolTip>

Available Props

| Prop name | Prop type | Default | | ------------- |:-------------:| ---------:| | className | string | undefined | | style | object | undefined | | btnClassName | string | undefined | | btnStyle | object | undefined | | innerStyle | object | undefined | | displayed | bool | false |

Customization

You can override tooltip popover style with props innerStyle

If you want override some default style, you can import the default style and update it.

import defaultInnerStyle from 'react-responsive-tooltip/lib/script/styles/tooltip-inner';
import defaultTriggerStyle from 'react-responsive-tooltip/lib/script/styles/tooltip-trigger';

// defaultInnerStyle is an immutable map
const innerStyle = defaultInnerStyle.set('fontSize', '10pt');
const triggerStyle = defaultTriggerStyle.set('backgroundColor', 'blue');

const triggerLayout = <span className='btn btn-default'>?</span>;

<Tooltip triggerStyle={triggerStyle} triggerLayout={triggerLayout} innerStyle={innerStyle}>
	...
</Tooltip>

Example

'use strict';

import Tooltip from 'react-responsible-tooltip';
import React from 'react';

const Example = React.createClass({
	render() {
		return (
			<div>
				<h1>Simple tooltip example</h1>

				<Tooltip>
					<div>
						<div>My tooltip text</div>
						<div>Could be html or another React components
					</div>
				</Tooltip>

				<h1>Customize the trigger tooltip example</h1>

				const trigger = '<span style={{pointer: 'help'}}>Could be text trigger also</span>';
				<Tooltip btnLayout={trigger}>
					<div>Another tooltip text</div>
				</Tooltip>
			</div>
		);
	}
});

export default Example;

Compile es6 sources

$ npm run compile

Sources will be compiled with babel in the lib directory

You must have Babel 6 installed in global

$ npm install --global babel-cli

Babel presets are in devDependencies, don't forget doing

$ npm install