Giter Club home page Giter Club logo

vue-tooltipper's Introduction

vue-tooltipper

A Vue3 plugin that makes it a easy to create tooltips for your projects. This plugin is simply a wrapper for the Tippy.js library.

Getting Started

To install in your project use next.

npm install vue-tooltipper

Then you must configure in your main.ts or main.js file of your project and place the following

import {createTooltipPlugin} from "vue-tooltipper";
import "vue-tooltipper/styles.css";

createApp(App).use(createTooltipPlugin()).mount('#app')

Tippy.js is a very complete library and you will be able to make use of all its options, just by passing to the createTooltipPlugin()function the options you want to add; for example, by default the option to show the arrow of the tooltip is disabled, so to activate it you only need to change that option to arrow=true.

createApp(App).use(createTooltipPlugin({arrow: true})).mount('#app')

The same is for any other option. Here you have a link to the Tippy.js library with the supported options which you can add to your plugin configuration.

With this you will be able to place the ToolTip component anywhere your project needs it, without the need to register it, and the way to do it is as follows.

<div class="card">
    <button type="button" @click="count++">count is {{ count }}
        <ToolTip text="Tooltipper"/>
    </button>
    <p>
        Edit
        <code>components/HelloWorld.vue</code> to test HMR
    </p>
</div>

You can pass the text to be displayed by the ToolTip component with the text property

Vue Directive

The vue-tooltipper directive makes it even easier to create amazing tooltips for your applications, as well as adding v-tooltip and assigning it the content to display.

<p v-tooltip="'Edit the component'">
    Edit
    <code>components/HelloWorld.vue</code> to test HMR
</p>

You can also add the options you need in the following way. Posiblemente

import type {TooltipperOptions} from 'vue-tooltipper'

const options: TooltipperOptions = {
    placement: 'right-end',
    trigger: 'click'
}

And in the directive send them as an argument

<p v-tooltip:[options]="'Edit the component'">
    Edit
    <code>components/HelloWorld.vue</code> to test HMR
</p>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.