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

svelte-tooltip

v1.2.0

Published

### Table of contents

Downloads

1,321

Readme

Svelte Tooltip

Table of contents

Getting Started

Instalation

To install Svelte Tooltip into your svelte project use your package manager npm/yarn run one of the following commands on your terminal.

npm install svelte-tooltip or yarn add svelte-tooltip

Usage

Svelte Tooltip is really simple to use, first you need to import it on a script section

<script>
	import SvelteTooltip from 'svelte-tooltip';
</script>

and then use it on your component html template, passing as slot whatever you want to trigger the tooltip when hovered, usually these is going to be a button, icon, image, or a link.

<SvelteTooltip tip="view on github" bottom >
	<button>Click me</button>
</SvelteTooltip>

**Important: ** make sure to allways use one and just one directional prop, top, right, bottom, or left , those will position the tooltip according to the slot will passed, and not setting any or setting multiple will cause undefined behavior.

Properties

active

The active allows you to programmatically display a tooltip rather than waiting to a user hover, it's expected type is boolean and it defaults to false.

<SvelteTooltip tip="this is visible" left active>

color

The default Svelte Tooltip background-color is #757575, however you can easily change that with the color property, it's type is String and any css valid color is also valid for this property.

<SvelteTooltip tip="change the color" top color="#FFB74D">

tip

tip property is the actual text displayed inside the tooltip.

<SvelteTooltip tip="view on github" bottom >

Directional Props

The directional props allows you to position your tooltip in relation to the slot you give to the tooltip. As mentioned above SvelteTooltip should take exactly one directional prop.

top

<SvelteTooltip tip="I'm on the top" top >

right

<SvelteTooltip tip="I'm on the right" right >

bottom

<SvelteTooltip tip="I'm on the bottom" bottom >

left

<SvelteTooltip tip="I'm on the left" left >

Useful tips

Changing text color

Svelte tooltip has no default way of changing it's text color, however since the tooltip component inherits the text color from it's parent. The recomended way to set the text color is by wrapping the tooltip inside a div and use the css color attribute on it.

<style>
.wrapper {
  color: #fafafa;
}
</style>

<div class="wrapper">
	<SvelteTooltip tip="white text" bottom  color="#EF6C00">
		<button>Click me</button>
	</SvelteTooltip>
</div>