vue-tippy 6.0.0-alpha.9 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,5 +1,113 @@
1
- # VueTippy - V6 - WIP
1
+ # VueTippy - V6
2
2
 
3
- [![npm](https://img.shields.io/npm/v/vue-tippy.svg)](https://www.npmjs.com/package/vue-tippy) [![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/) [![download](https://img.shields.io/npm/dt/vue-tippy.svg)](https://www.npmjs.com/package/vue-tippy)
3
+ [![npm](https://img.shields.io/npm/v/vue-tippy/next.svg)](https://www.npmjs.com/package/vue-tippy) [![vue2](https://img.shields.io/badge/vue-3.x-brightgreen.svg)](https://vuejs.org/) [![download](https://img.shields.io/npm/dt/vue-tippy.svg)](https://www.npmjs.com/package/vue-tippy)
4
4
 
5
- > Directive wrapper for Tippy.js
5
+ > Vue.js 3 wrapper for Tippy.js
6
+
7
+ <aside class="notice">
8
+ <a href="https://github.com/KABBOUCHI/vue-tippy/tree/v4">For Tippy.js v4 use v4 branch</a>
9
+ </aside>
10
+
11
+
12
+ ## Documentation
13
+
14
+ For full v6 documentation, visit [https://vue-tippy.netlify.app/](https://vue-tippy.netlify.app/).
15
+
16
+ ## Installation
17
+
18
+ ```js
19
+ npm install vue-tippy@v6
20
+
21
+ //or
22
+
23
+ yarn add vue-tippy@v6
24
+ ```
25
+
26
+ ## Configuration (optional)
27
+
28
+ ```js
29
+ import { createApp } from 'vue'
30
+
31
+ import VueTippy from 'vue-tippy'
32
+ // or
33
+ import { plugin as VueTippy } from 'vue-tippy'
34
+
35
+ const app = createApp({})
36
+
37
+ app.use(
38
+ VueTippy,
39
+ // optional
40
+ {
41
+ directive: 'tippy', // => v-tippy
42
+ component: 'tippy', // => <tippy/>
43
+ }
44
+ )
45
+
46
+ app.mount('#app')
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### Vue Directive
52
+
53
+ ```html
54
+ <template>
55
+ <button v-tippy="{ content: 'Hi!' }">Tippy!</button>
56
+ <button v-tippy="'Hello!'">Tippy!</button>
57
+ </template>
58
+
59
+ <!--
60
+ The below is optional in case you
61
+ installed the plugin globally
62
+ -->
63
+ <script>
64
+ import { directive } from 'vue-tippy'
65
+
66
+ export default {
67
+ directives: {
68
+ tippy: directive,
69
+ },
70
+ }
71
+ </script>
72
+ ```
73
+
74
+ ### Vue Component
75
+
76
+ ```html
77
+ <template>
78
+ <tippy content="Hi!">
79
+ <button>Tippy!</button>
80
+ </tippy>
81
+ </template>
82
+
83
+ <!--
84
+ The below is optional in case you
85
+ installed the plugin globally
86
+ -->
87
+ <script>
88
+ import { Tippy } from 'vue-tippy'
89
+
90
+ export default {
91
+ components: [Tippy],
92
+ }
93
+ </script>
94
+ ```
95
+
96
+ ### Using composition api
97
+
98
+ ```js
99
+ import { defineComponent, ref, h } from 'vue'
100
+ import { useTippy } from 'vue-tippy'
101
+
102
+ export default defineComponent({
103
+ setup() {
104
+ const button = ref()
105
+
106
+ useTippy(button, {
107
+ content: 'Hi!',
108
+ })
109
+
110
+ return () => h('button', { ref: button }, 'Tippy!')
111
+ },
112
+ })
113
+ ```