Skip to content

Commit

Permalink
Add possibility to cancel from onShow event
Browse files Browse the repository at this point in the history
  • Loading branch information
emilpalsson committed Jun 23, 2020
1 parent b2e430e commit 413b0d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const HeaderWithTooltip = withTooltip(Header, {
|stickyDuration|200|Any number (milliseconds)|Specifies the 'smoothing' transition when the popper's position updates as its element moves.|
|tag|`div`|A HTML element tag name e.g. `span`|Specifies the HTML element used to wrap the content that triggers the tooltip. When using a tooltip inline, `span` is more likely to be valid markup. When using a higher-order component with a block-level element, a `div` or `a` is more likely to be valid markup.|
|touchHold|false|`true` `false`|Changes the trigger behavior on touch devices. It will change it from a tap to show and tap off to hide, to a tap and hold to show, and a release to hide.|
|onShow|noop|function|Callback when the tooltip has been triggered and has started to transition in|
|onShow|noop|function|Callback when the tooltip has been triggered and has started to transition in, return `false` to cancel the show|
|onShown|noop|function|Callback when the tooltip has fully transitioned in and is showing|
|onHide|noop|function|Callback when the tooltip has begun to transition out|
|onHidden|noop|function|Callback when the tooltip has fully transitioned out and is hidden|
Expand Down
4 changes: 3 additions & 1 deletion src/Tooltip/js/tippy.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ class Tippy {
return
}

this.callbacks.show.call(popper)
if (this.callbacks.show.call(popper, data.el) === false) {
return
}

// Custom react
if (data.settings && data.settings.open === false) {
Expand Down

0 comments on commit 413b0d2

Please sign in to comment.