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

@programic/vue3-tooltip

v1.0.0

Published

An advanced tooltip plugin for Vue 3 and Nuxt 3

Downloads

229

Readme

Vue 3 & Nuxt 3 Tooltip

npm version Vue 3 Bundle codecov

vt

Features

  • Vue 3 compatible!
  • Nuxt 3 compatible!
  • Generic registration allows it to be used inside any app!
  • Fully written in Typescript with full types support
  • Easy to set up for real, you can make it work in less than 10sec!
  • Customize everything
  • Use your custom components as the tooltip body for endless possibilities!
  • Define behavior per tooltip
  • Use your themes and animations easily
  • And much more!

Installation

$ yarn add @programic/vue3-tooltip
$ npm install --save @programic/vue3-tooltip

Usage

Plugin registration

Add it as a plugin to your app:

import { createApp } from "vue";
import Tooltip from "@programic/vue3-tooltip";
// Import the CSS or use your own!
import '@programic/vue3-tooltip/dist/index.css';

const app = createApp(...);

const options = {
    // You can set your default options here
};

app.use(Tooltip, options);

Or, if you are using Typescript:

import { createApp } from "vue";
import Tooltip from '@programic/vue3-tooltip';
import type { TooltipConfiguration } from '@programic/vue3-tooltip';

// Import the CSS or use your own!
import '@programic/vue3-tooltip/dist/index.css';

const app = createApp(...);

const options: TooltipConfiguration = {
    // You can set your default options here
};

app.use(Tooltip, options);

Or, if you are using Nuxt 3:

Create a tooltip.ts in the plugins folder with the following code

// tooltip.ts
import { defineNuxtPlugin } from "#app";
import Tooltip from '@programic/vue3-tooltip';

export default defineNuxtPlugin(nuxtApp => {
    nuxtApp.vueApp.use(Tooltip)
});

Creating tooltips by directive

To create tooltips by directive, add v-tooltip on your element

<p><span v-tooltip="this is a tooltip">Hover me</span></p>

Creating tooltips by component

For more options and configurations use tooltip by a component

<script>
    import { Tooltip } from '@programic/vue3-tooltip';
</script>

<template>
    <Tooltip title="tooltip test">Hover me</Tooltip>
</template>

Positioning the Tooltip

By default, the tooltip will be displayed at the top of the element, but you can set it manually using the placement option.

You can use the type definitions or one of the allowed values: top, right, bottom, left.

import Tooltip from '@programic/vue3-tooltip';

app.use(Tooltip, {
    // Setting the global default position
    position: 'bottom',
});


// Or set it per tooltip
<Tooltip title="tooltip test" placement="bottom">Hover me</Tooltip>

Tooltip types

Depending on the context, you may want to use tooltips of different colors. You can easily do that by setting the type of tooltip to be displayed.

<Tooltip title="tooltip test" type="light">Hover me</Tooltip>

// You can also set the type programmatically when calling the default toast
import Tooltip from '@programic/vue3-tooltip';

app.use(Tooltip, {
    // Setting the global default type
    type: 'light',
});

API

Plugin registration (app.use)

| Option | Type | Default | Description | |------------------------|-------------------------------------------------------------------|-----------------------------------------------------| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | placement | String | top | Position of the toast on the screen. Can be any of top-right, top-center, top-left, bottom-right, bottom-center, bottom-left. | | container | Object or Boolean | true | Whether or not the newest toasts are placed on the top of the stack. |

Tooltip (props)

| Props | Type | Required | Description | |-------------|-------------|----------|------------------------------------------------------------------| | container | HTMLElement | No | Override global container config where tooltip needs teleported) | | trigger | String | No | When the tooltip opens | | placement | String | No | The position of the tooltip | | size | String | No | The tooltip size | | type | String | No | The tooltip type | | title | String | No | The tooltip title | | description | String | No | The tooltip description |

License

Copyright (C) 2022 Programic. Licensed under MIT