File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,19 @@ class ReactTooltip extends Component {
46
46
afterHide : PropTypes . func ,
47
47
disable : PropTypes . bool ,
48
48
scrollHide : PropTypes . bool ,
49
- resizeHide : PropTypes . bool
49
+ resizeHide : PropTypes . bool ,
50
+ wrapper : PropTypes . string
50
51
} ;
51
52
52
53
static defaultProps = {
53
54
insecure : true ,
54
- resizeHide : true
55
+ resizeHide : true ,
56
+ wrapper : 'div'
57
+ } ;
58
+
59
+ static supportedWrappers = {
60
+ 'div' : React . DOM . div ,
61
+ 'span' : React . DOM . span
55
62
} ;
56
63
57
64
constructor ( props ) {
@@ -428,18 +435,22 @@ class ReactTooltip extends Component {
428
435
{ 'type-info' : this . state . type === 'info' } ,
429
436
{ 'type-light' : this . state . type === 'light' }
430
437
)
438
+
439
+ let wrapper = ReactTooltip . supportedWrappers [ this . props . wrapper ]
440
+ if ( ! wrapper ) wrapper = ReactTooltip . supportedWrappers [ 'div' ]
441
+
431
442
if ( html ) {
432
443
return (
433
- < div className = { `${ tooltipClass } ${ extraClass } ` }
444
+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
434
445
{ ...ariaProps }
435
446
data-id = 'tooltip'
436
- dangerouslySetInnerHTML = { { __html : placeholder } } > </ div >
447
+ dangerouslySetInnerHTML = { { __html : placeholder } } > </ wrapper >
437
448
)
438
449
} else {
439
450
return (
440
- < div className = { `${ tooltipClass } ${ extraClass } ` }
451
+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
441
452
{ ...ariaProps }
442
- data-id = 'tooltip' > { placeholder } </ div >
453
+ data-id = 'tooltip' > { placeholder } </ wrapper >
443
454
)
444
455
}
445
456
}
You can’t perform that action at this time.
0 commit comments