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 feature in Tooltip #178

Open
wants to merge 2 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 @@ -122,6 +122,7 @@ const HeaderWithTooltip = withTooltip(Header, {
|onHidden|noop|function|Callback when the tooltip has fully transitioned out and is hidden|
|theme|`dark`|`dark` `light` `transparent`|The CSS styling theme.|
|className|''|string|className of container|
|appendTo|`document.body`|`function` `dom element`|Destination element for attaching the tooltip. You can pass DOM element or callback function which returns dom element|
|style|{}|React inline style (object)|style of container|


Expand Down
132 changes: 71 additions & 61 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.

2 changes: 2 additions & 0 deletions src/Tooltip/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const defaultProps = {
size: 'regular',
className: '',
style: {},
appendTo: () => document.body,
distance: 10,
onRequestClose: () => {},
sticky: false,
Expand Down Expand Up @@ -222,6 +223,7 @@ class Tooltip extends Component {
onHidden: this.props.onHidden,
distance: this.props.distance,
reactDOM: this.props.html,
appendTo: this.props.appendTo,
setReactDOMValue: newReactDOM => this.setState({ reactDOMValue: newReactDOM }),
unmountHTMLWhenHide: this.props.unmountHTMLWhenHide,
open: this.props.open,
Expand Down
3 changes: 2 additions & 1 deletion src/Tooltip/js/tippy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import onTransitionEnd from './core/onTransitionEnd'
import mountPopper from './core/mountPopper'
import makeSticky from './core/makeSticky'
import createTooltips from './core/createTooltips'
import evaluateSettings from './core/evaluateSettings'

/**
* @param {String|Element|Element[]} selector
Expand Down Expand Up @@ -118,7 +119,7 @@ class Tippy {
...data.settings,
[name]: value,
}
data.settings = newSettings;
data.settings = evaluateSettings(newSettings);
};

/**
Expand Down