Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add appendTo support to mount tippy to any element on the page #111

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const HeaderWithTooltip = withTooltip(Header, {
|--- |--- |--- |--- |
|disabled|`false`|`true` `false`|Show or not show tooltip|
|open|`undefined`|`true` `false`|Just only use it if you want to `show/hide it manually`. Usually, you don't need it|
|appendTo|`document.body`|`function`|Target element for appending the tooltip element.
|useContext|`undefined`|`true` `false`|Define that you're using context in your tooltip content (or `html` props). It's useful when you want your tooltip content can connect to redux store|
|onRequestClose|`noop function`|Function|Just only use it if you want to `show/hide it manually`. This event is fired when you click outside of your tooltip, should be used with the prop `interaction` to keep your tooltip showing|
|position|`top`|`top` `bottom` `left` `right`|Specifies which direction to position the tooltip on the element. Add the suffix `-start` or `-end` to shift the position. `top-end` is an example.|
Expand Down
1 change: 1 addition & 0 deletions dist/react-tippy.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/react-tippy.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Tooltip/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ class Tooltip extends Component {
if (!this.props.disabled) {
this.tooltipDOM.setAttribute('title', this.props.title);
this.tippy = tippy(this.tooltipDOM, {
appendTo: this.props.appendTo || document.body,
disabled: this.props.disabled,
position: this.props.position,
animation: this.props.animation,
Expand Down