@@ -26,7 +26,8 @@ Add dependencies to your `main.ts`:
26
26
27
27
``` js
28
28
import { createApp } from ' vue'
29
- import { TooltipDirective , TooltipComponent } from ' vue3-tooltip'
29
+ import { TooltipDirective , TooltipComponent } from ' vue3-tooltip' ;
30
+ import ' vue3-tooltip/tooltip.css' ;
30
31
31
32
const app = createApp ({... })
32
33
app .directive (' tooltip' , TooltipDirective)
@@ -91,7 +92,16 @@ The component has the following props *(default values are highlighted in bold)*
91
92
` clickable ` * (true | ** false** )* - do not hide the tooltip when hovering over it
92
93
93
94
## Style customization
94
- To customize tooltip directive, you need to create a global style file using ` CSS ` or ` Sass ` . My example demonstrates this process:
95
+ To customize styles, you need to paste your CSS file into ` main.ts ` after importing the basic tooltip styles ` (vue3-tooltip/tooltip.css) ` :
96
+
97
+ ``` js
98
+ import { TooltipDirective , TooltipComponent } from ' vue3-tooltip' ;
99
+ import ' vue3-tooltip/tooltip.css' ;
100
+ // After this line you need to do your import
101
+ import ' ./assets/my-tooltip.scss' ;
102
+ ```
103
+
104
+ To customize tooltip ** directive** , you need to create a global style file using ` CSS ` or ` Sass ` . My example demonstrates this process:
95
105
96
106
``` scss
97
107
.vue-tooltip {
@@ -110,7 +120,74 @@ To customize tooltip directive, you need to create a global style file using `CS
110
120
}
111
121
```
112
122
113
- If you want to explore customization in more detail and change all the classes in the module , you should check them out at [this link ](https :// github.com/neluckoff/vue3-tooltip/blob/master/src/assets/directive.css).
123
+ * If you want to explore customization in more detail and change all the classes in the module , you should check them out at [this link ](https :// github.com/neluckoff/vue3-tooltip/blob/master/src/assets/_directive.css).*
124
+
125
+ To customize the ** component** , you can also override the standard styles:
126
+
127
+ ```scss
128
+ .vue- tooltip {
129
+ &.disable {
130
+ // ... //
131
+ }
132
+ & --component {
133
+ /*
134
+ * font-size, line-height, max-width, padding, border-radius, box-shadow, transition
135
+ */
136
+ }
137
+ }
138
+ ```
139
+
140
+ * You can go deeper into component styles at [ this link] ( https://github.com/neluckoff/vue3-tooltip/blob/master/src/assets/_component.css ) .*
141
+
142
+ Or, instead of redefining classes, you can use variables, on which the entire tooltip design is based. If you want to add new variables, you can write to [ Issues on GitHub] ( https://github.com/neluckoff/vue3-tooltip/issues ) .
143
+
144
+ ``` css
145
+ :root {
146
+ /* Directive Variables */
147
+ --tooltip-d-transition-duration : 0.4s ;
148
+ --tooltip-d-border-radius : 4px ;
149
+ --tooltip-d-padding : 2px 4px ;
150
+ --tooltip-d-position-x : calc (100% + 10px );
151
+ --tooltip-d-position-y : calc (100% + 2px );
152
+ --tooltip-d-box-shadow : 0px 3.2px 7.2px 0px rgba (0 , 0 , 0 , 0.14 ),
153
+ 0px 0.6px 1.8px 0px rgba (0 , 0 , 0 , 0.1 ),
154
+ 0px -1.5px 6px 0px rgba (0 , 0 , 0 , 0.06 );
155
+ --tooltip-d-z-index : 10 ;
156
+ --tooltip-d-max-width : 200px ;
157
+ --tooltip-d-font-size : 14px ;
158
+ --tooltip-d-width : max-content ;
159
+ --tooltip-d-height : max-content ;
160
+ --tooltip-d-outline : none ;
161
+ --tooltip-d-border : none ;
162
+
163
+ /* Component Variables */
164
+ --tooltip-c-transition-duration : 0.4s ;
165
+ --tooltip-c-border-radius : 4px ;
166
+ --tooltip-c-padding : 2px 4px ;
167
+ --tooltip-c-position-x : calc (100% + 10px );
168
+ --tooltip-c-position-y : 100% ;
169
+ --tooltip-c-box-shadow : 0px 3.2px 7.2px 0px rgba (0 , 0 , 0 , 0.14 ),
170
+ 0px 0.6px 1.8px 0px rgba (0 , 0 , 0 , 0.1 ),
171
+ 0px -1.5px 6px 0px rgba (0 , 0 , 0 , 0.06 );
172
+ --tooltip-c-z-index : 10 ;
173
+ --tooltip-c-max-width : max-content ;
174
+ --tooltip-c-width : max-content ;
175
+ --tooltip-c-height : max-content ;
176
+ --tooltip-c-outline : none ;
177
+ --tooltip-c-border : none ;
178
+
179
+ /* Colors */
180
+ --tooltip-primary-color : #212121 ;
181
+ --tooltip-primary-background : #fff ;
182
+ --tooltip-seconary-color : #fff ;
183
+ --tooltip-seconary-background : #475DEB ;
184
+ --tooltip-accent-color : #fff ;
185
+ --tooltip-accent-background : #212121 ;
186
+
187
+ --tooltip-component-color : #212121 ;
188
+ --tooltip-component-background : #fff ;
189
+ }
190
+ ```
114
191
115
192
## Contributing
116
193
I have a positive attitude towards PR and pull requests. Glad to see that people like the package.
0 commit comments