Skip to content

Commit a75b2be

Browse files
committed
feat(clickable-prop): add clickable prop
add clickable prop which enables tooltip to respond to mouse (or touch) events fix #417
1 parent 9e876e1 commit a75b2be

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Diff for: src/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ class ReactTooltip extends React.Component {
5757
disable: PropTypes.bool,
5858
scrollHide: PropTypes.bool,
5959
resizeHide: PropTypes.bool,
60-
wrapper: PropTypes.string
60+
wrapper: PropTypes.string,
61+
clickable: PropTypes.bool
6162
};
6263

6364
static defaultProps = {
6465
insecure: true,
6566
resizeHide: true,
66-
wrapper: 'div'
67+
wrapper: 'div',
68+
clickable: false
6769
};
6870

6971
static supportedWrappers = ['div', 'span'];
@@ -539,7 +541,8 @@ class ReactTooltip extends React.Component {
539541
{'type-error': this.state.type === 'error'},
540542
{'type-info': this.state.type === 'info'},
541543
{'type-light': this.state.type === 'light'},
542-
{'allow_hover': this.props.delayUpdate}
544+
{'allow_hover': this.props.delayUpdate},
545+
{'allow_click': this.props.clickable}
543546
)
544547

545548
let Wrapper = this.props.wrapper

Diff for: src/index.scss

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
top: -999em;
6868
visibility: hidden;
6969
z-index: 999;
70-
&.allow_hover {
70+
&.allow_hover,
71+
&.allow_click {
7172
pointer-events:auto;
7273
}
7374
&:before,

0 commit comments

Comments
 (0)