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

@studyportals/tooltip

v2.0.1

Published

A generic tooltip component.

Downloads

796

Readme

Tooltip

This is the Studyportals implementation of tooltips as defined in the design system. More information can be found in the Studyportals StyleGuide.

Tooltip can be implemented as a DLL dependency.

Table of Contents

Setup & commands

The following commands can be used to setup and run a local environment for developing the tooltip component. Also, we're using husky to run unit tests before a git push is done. This could be by-passed (if absolutely necessary) by running git push --no-verify.

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm start

# build for production with minification
npm run build

# run linter
npm run lint
npm run lint:fix # with fix

# run unit tests
npm run unit

Tooltip types

There are two variations of the tooltip component your application can use, these are called ContextualTooltip and GuidanceTooltip. While they are a bit different in their purpose, they are largely the same in the way they are implemented in your code. The only differences are that GuidanceTooltip works with a click interaction instead of hover interactions and has an additional configuration option to disable click interactions on the element it's bound to.

const simple = new ContextualTooltip({
	element: HTMLElement,
	content: HTMLElement | string,
	position?: Position
})
const complex = new GuidanceTooltip({
	element: HTMLElement,
	content: HTMLElement | string,
	position?: Position,
	disableClick?: boolean,
	onClose?: Function
})

Tooltip configuration

|Property|Type|Description| |--------|----|-----------| |element|HTMLElement|The element which the tooltip will be bound to.| |content|HTMLElement or string|The content of the tooltip.| |position (optional)|Position (bottom or top)|The vertical position of the tooltip. (defaults to top)| |disableClick (optional)|boolean|Disables click listener on element the tooltip is bound to.| |onClose (optional)|Function|A callback for when a user dismisses the tooltip with the close button.|

Tooltip styling

When using Tooltip in your code, you should also make sure the default Tooltip styling is included. This can be done by importing it like so:

@import '~@studyportals/tooltip/dist/tooltip.css';