- Notifications
You must be signed in to change notification settings - Fork0
vue-comps/vue-comps-tooltip
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
DEPRECATED seecerijs andceri-tooltip
a unstyled tooltip, which adjusts opening direction to be in viewport.
npm install --save-dev vue-comps-tooltip
or includebuild/bundle.js.
# in your componentcomponents:"tooltip":require("vue-comps-tooltip")# or, when using bundle.jscomponents:"tooltip":window.vueComps.tooltip
<button> Hover<tooltip>Content</tooltip></button>
seedev/ for examples.
| Name | type | default | description |
|---|---|---|---|
| offset | Number | 0 | offset to the parent |
| anchor | String | "snwe" | direction of opening, viewport dependent. "s" forces to open down. "sn" would try to open down, the up. |
| ignore-parent | Boolean | false | will not set-upmouseenter/mouseleave listener on parent |
| is-opened | Boolean | false | (two-way) set to open / close |
| transition | String | "tooltip" | name of a vue transition.Detailed description |
| parent | Element | parentElement | where the tooltip should attach its listeners |
| on-body | Boolean | false | will be positioned on body instead of parent element.Detailed description |
| Name | description |
|---|---|
| before-enter | will be called before open animation |
| after-enter | will be called when opened |
| before-leave | will be called before close animation |
| after-leave | will be called when closed |
| toggled(isOpened:Boolean) | emitted when gets opened or closed. Alternative to use two-wayis-opened prop |
There are two ways of positioning. The default is as a child of the parent element, the other posibility is onbody.
- The parent positioning can be problematic when you have an
overflow:hiddenas a parent to the nearest element withposition:absolute|relative|fixedand the tooltip is overflowing. - the
bodypositioning can be problematic when the parent is moving relative tobodyor when you depend on inheritance of styles.
You can provide a vue transition like this:
Vue.transition("fade",{// your transition})// or in the instance:transitions:{fade:{// your transition}}// usage:template:"<tooltip transition='fade'></tooltip>"
You can access several properties in your enter hook:
enter:function(el,cb){// in which direction the tooltip will open. one of s, n, w or ethis.direction// style properties as numbersthis.topthis.leftthis.widththis.heightthis.offset// will be added on or subtracted of top or left depending on direction}
seedev/transition for a working example.
1.1.0
added toggled event
set default transition1.0.0
renamedpositionprop toon-body- now is a boolean
now using vue transitions
events are renamed after vue transitions
Clone repository.
npm installnpm run dev
Browse tohttp://localhost:8080/.
Copyright (c) 2016 Paul PflugradtLicensed under the MIT license.
About
a advanced tooltip
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.