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 @@ -44,11 +44,18 @@ class ReactTooltip extends Component {
44
44
afterHide : PropTypes . func ,
45
45
disable : PropTypes . bool ,
46
46
scrollHide : PropTypes . bool ,
47
- resizeHide : PropTypes . bool
47
+ resizeHide : PropTypes . bool ,
48
+ wrapper : PropTypes . string
48
49
} ;
49
50
50
51
static defaultProps = {
51
- resizeHide : true
52
+ resizeHide : true ,
53
+ wrapper : 'div'
54
+ } ;
55
+
56
+ static supportedWrappers = {
57
+ 'div' : div ,
58
+ 'span' : span
52
59
} ;
53
60
54
61
constructor ( props ) {
@@ -417,18 +424,22 @@ class ReactTooltip extends Component {
417
424
{ 'type-info' : this . state . type === 'info' } ,
418
425
{ 'type-light' : this . state . type === 'light' }
419
426
)
427
+
428
+ let wrapper = ReactTooltip . supportedWrappers [ this . props . wrapper ]
429
+ if ( ! wrapper ) wrapper = div
430
+
420
431
if ( html ) {
421
432
return (
422
- < div className = { `${ tooltipClass } ${ extraClass } ` }
433
+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
423
434
{ ...ariaProps }
424
435
data-id = 'tooltip'
425
- dangerouslySetInnerHTML = { { __html : placeholder } } > </ div >
436
+ dangerouslySetInnerHTML = { { __html : placeholder } } > </ wrapper >
426
437
)
427
438
} else {
428
439
return (
429
- < div className = { `${ tooltipClass } ${ extraClass } ` }
440
+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
430
441
{ ...ariaProps }
431
- data-id = 'tooltip' > { placeholder } </ div >
442
+ data-id = 'tooltip' > { placeholder } </ wrapper >
432
443
)
433
444
}
434
445
}
You can’t perform that action at this time.
0 commit comments