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

v0.1.0

Published

<h1 align="center">Welcome to svelte-tooltips 👋</h1> <p> <img alt="Version" src="https://img.shields.io/badge/version- (0.2.0)-blue.svg?cacheSeconds=2592000" /> <a href="https://github.com/DonutLaser/svelte-tooltips#readme" target="_blank"> <img

Downloads

2

Readme

A package that provides a highly customizable way to open tooltips in Svelte on any DOM element

🏠 Homepage

Install

npm install svelte-tooltips

Usage

Adding a tooltip to an element

<!-- App.svelte -->
<script>
    import { tooltip } from 'svelte-tooltips';

</script>

<button use:tooltip={{ message: "Hello from the tooltip" }}>This is a button</button>

To add a tooltip, use use:tooltip directive, provide it an options object and the tooltip will be available for as long as the dom element is not destroyed.

Notes:

  • A tooltip will always be rendered as a child of the body
  • There can only be one tooltip open at a time

Tooltip options

| Option | Type | Default value | Description | |---------------------------|---------|---------------|----------------------------------------------------------------------------------------------------------------------------------------------| | message (Required) | string | | A message to show in the tooltip, can only be text. | | tooltipClass | string | | A class that will style the tooltip. Must be defined in global.css. Overrides the default style completely. | | placement | string | top | Can be one of: left, right, top or bottom. Does nothing when openNextToMouseCursor is set to true. | | offset | number | 0 | An offset from the element and the tooltip. Does nothing when openNextToMouseCursor is set to true. | | delay | number | 0 | Delay in milliseconds to wait before showing the tooltip. | | openNextToMouseCursor | boolean | false | Whether to open the tooltip in a manner similar to the native tooltip of the browser instead of putting the tooltip next to the DOM element |

Global options

To avoid having to set the same options on for every DOM element that has a tooltip, it is possible to set the global options for all the tooltips. This way, you will only need to provide the message to the tooltip to show it and every other option will be taken from the global options you have set. If you set global options, but have a tooltip that has to have some different options, you can set the options on the tooltip and they will override the global ones.

<!-- App.svelte -->
<script>
  import { onMount } from "svelte";
  import { setGlobalTooltipOptions } from "svelte-tooltips";

  onMount(() => {
    setGlobalTooltipOptions({
      tooltipClass: 'tooltip',
      delay: 500,
      openNextToMouseCursor: true
    });
  });
</script>

Author

👤 Vidmantas Luneckas

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2021 Vidmantas Luneckas. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator