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

sv-bootstrap-tooltip

v0.2.1

Published

Tooltip(Bootstrap) component for Svelte

Downloads

134

Readme

sv-bootstrap-tooltip (Svelte Bootstrap Tooltip)

Svelte Tooltip Component for Bootstrap (Bootstrap’s tooltip plugin in svlete applications), can be used with sapper or standalone with svelte.Just like Vainilla bootstrap this plugin too is built on a third party library, Popper.js, which provides dynamic positioning and viewport detection. But Unlike Vainilla bootstrap we are using PopperJs V2 instead of V1

How to install

  1. npm install --save-dev sv-bootstrap-tooltip @rollup/plugin-replace
  2. Add below code in your rollup config
import replace from '@rollup/plugin-replace';
..
..
..
plugins: [
  ..., // Other Plugins
  ..., // Other Plugins
replace({
	  'process.env.NODE_ENV': JSON.stringify('production'),
	   include: '**/node_modules/**',
    })
]

Requirements

Bootstrap CSS needs to be present globally in project

Usage

Simple

Example

<script>
  import Tooltip from "sv-bootstrap-tooltip";
  let referenceEle;
</script>

<button type="button" class="btn btn-secondary" bind:this={referenceEle}>
Tooltip on top
</button>
<Tooltip triggerElement={referenceEle}>Tooltip</Tooltip>

HTML inside Tooltip

You can pass the any html between opening and closing tag of Tooltip Element

Example

<script>
  import Tooltip from "sv-bootstrap-tooltip";
  let referenceEle;
</script>

<button type="button" class="btn btn-secondary" bind:this={referenceEle}>
Tooltip on top
</button>
<Tooltip triggerElement={referenceEle}>
<em>Tooltip</em>
<u>with</u>
<b>HTML</b>
</Tooltip>

Placement

This option is used to define the placement of tooltip on an triggerElement. By default the placement is top

Example

<script>
  import Tooltip from "sv-bootstrap-tooltip";
  let referenceEle;
</script>

<button type="button" class="btn btn-secondary" bind:this={referenceEle}>
    Tooltip on top
  </button>
<Tooltip triggerElement={referenceEle} placement="left">Tooltip</Tooltip>

Complete Placement Options

Options are similar to Vanilla Bootstrap

|Placement|Description| |--- |--- | |auto|Placements will choose the side with most space and arrow will be in the center of trigger element| |top|Placements will be on top and arrow will be in the center of trigger element| |bottom|Placements will be bottom and arrow will be in the center of trigger element| |right|Placements will be right and arrow will be in the center of trigger element| |left|Placements will be left and arrow will be in the center of trigger element|

Flip

This option should tell the Tooltip to filp side if there is no space on the prefered side

Example

<script>
    import Tooltip from "sv-bootstrap-tooltip";
    let referenceEle;
</script>

<button type="button" class="btn btn-secondary" bind:this={referenceEle}>
Tooltip on top
</button>
<Tooltip flip="false" triggerElement={referenceEle}>
</Tooltip>

Component Options

|Name|Type|Default|Description| |--- |--- |--- |--- | |open|boolean|false|This option is used to manage the Tooltip manually.| |flip|boolean|true|This option should tell the Tooltip to filp side if there is no space on the prefered side.| |trigger|string|hover|focus|How tooltip is triggered - click|hover|focus. You may pass multiple triggers; separate them with a |. |offset|[?number, ?number] or Function(Definition)|[0, 4]|The offset modifier lets you displace tooltip element from triggerElement element.| |placement|string|top|This option is used to define the placement of tooltip on an triggerElement.| |onOpened|function|Empty function(noop)|Can be used for callbacks after the tooltip is opened.| |onClosed|function|Empty function(noop)|Can be used for callbacks after the tooltip is closed.|


NOTE

For only manual triggering just pass empty string "" to trigger option and use open option to handle the tooltip manually

Todo

  • [ ] Animation
  • [ ] Adding More Placement options

License

MIT