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

smak-tooltip

v1.0.5

Published

React tooltip component library

Downloads

8

Readme

smak-tooltip

NPM JavaScript Style Guide JavaScript Style Guide

Install

npm

npm install smak-tooltip

yarn

yarn add smak-tooltip

React tooltip component library, Tooltip placement can be configure by passing position property. If there is not enough space then the placement will be auto adjust based on the space available. If no position prop is passed, tooltip will be place dynamically based on the space available on left, top, right and bottom. Styles can be customise by passing elementStyle prop. See IElementStyle interface below

Props

| Props | Type | Possible values | Required | | :----------- | :------------------------ | :--------------------------------------------------------- | :------- | | render | string or React.ReactNode | 'Tooltip text' or <span><b>Tooltip</b> text</span> | Required | | children | string | 'Tooltip' | Required | | position | string | 'auto' or 'left' or 'right' or 'top' or 'bottom' | Optional | | elementStyle | IElementStyle | {contentStyle: CSSProperties,containerStyle:CSSProperties} | Optional |

IElementStyle

interface IElementStyle {
  contentStyle?: CSSProperties;
  containerStyle?: CSSProperties;
}

Usage

import React from 'react';

import { Tooltip } from 'smak-tooltip';
import 'smak-tooltip/dist/index.css';

const App = () => {
  const pandemicNode = () => (
    <>
      <h2 style={{ marginTop: '0' }}>pan·dem·ic</h2>
      <small>/panˈdemik/</small>
      <br />
      <i>adjective</i>
      <p>(of a disease) prevalent over a whole country or the world.</p>
      <p style={{ color: 'orange' }}>Similar</p> <span>
        <i>
          <strong>widespread</strong>
        </i>
      </span>
      {', '}
      <span>
        <i>
          <strong>prevalent</strong>
        </i>
      </span>
    </>
  );

  const elementStyle = {
    containerStyle: {
      backgroundColor: 'red',
      width: '300px'
    },
    contentStyle: {
      color: 'yellow',
      fontSize: '1rem'
    }
  };
  return (
    <div style={{ padding: '10px' }}>
      The <Tooltip render='International Cricket Council'>ICC</Tooltip> on
      Friday, 7 August, confirmed the new schedule for major events affected by
      the global <Tooltip render={pandemicNode()}>pandemic</Tooltip>
      .
      <br />
      <br />
      The ICC Men's T20 World Cup 2020, which was supposed to be held in
      Australia in October-November, has been postponed to 2022.
      <br />
      <br />
      The 2021 edition of the T20 World Cup, which was scheduled in <Tooltip
        position='bottom'
        render='India, officially the Republic of India, is a country in South Asia.'
        elementStyle={elementStyle}
      >
        India
      </Tooltip>
      , will take place as planned.
      <br />
      <br />
      The format of the Men’s T20 World Cup 2021 will remain as it was for 2020,
      and all the teams who qualified for the 2020 event will now participate in
      the edition in India. A new qualification process will be run for the ICC Men’s
      T20 World Cup 2022.
      <br />
      <br />
      All fans who purchased tickets to the ICC Men’s T20 World Cup in{' '}
      <Tooltip
        position='left'
        render='Australia, officially the Commonwealth of Australia, is a sovereign country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands. '
      >
        Australia
      </Tooltip>
      <br />
      <br />
      tooltip example of rendering on <Tooltip
        position='left'
        render='Australia, officially the Commonwealth of Australia, is a sovereign country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands. '
      >
        left
      </Tooltip> side
      <br />
      <br />
      tooltip example of rendering on{' '}
      <Tooltip
        position='right'
        render='Australia, officially the Commonwealth of Australia, is a sovereign country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands. '
      >
        right
      </Tooltip>{' '}
      side <br />
      <br />
      tooltip example of rendering on{' '}
      <Tooltip
        position='top'
        render='Australia, officially the Commonwealth of Australia, is a sovereign country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands. '
      >
        top
      </Tooltip>
      <br />
      <br />
      tooltip example of rendering on <Tooltip
        position='bottom'
        render='Australia, officially the Commonwealth of Australia, is a sovereign country comprising the mainland of the Australian continent, the island of Tasmania, and numerous smaller islands. '
      >
        bottom
      </Tooltip>
    </div>
  );
};

export default App;

alt text

alt text

alt text

alt text

alt text

alt text

alt text

alt text

License

MIT © ShaileshMak