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 {
4646 afterHide : PropTypes . func ,
4747 disable : PropTypes . bool ,
4848 scrollHide : PropTypes . bool ,
49- resizeHide : PropTypes . bool
49+ resizeHide : PropTypes . bool ,
50+ wrapper : PropTypes . string
5051 } ;
5152
5253 static defaultProps = {
5354 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
5562 } ;
5663
5764 constructor ( props ) {
@@ -428,18 +435,22 @@ class ReactTooltip extends Component {
428435 { 'type-info' : this . state . type === 'info' } ,
429436 { 'type-light' : this . state . type === 'light' }
430437 )
438+
439+ let wrapper = ReactTooltip . supportedWrappers [ this . props . wrapper ]
440+ if ( ! wrapper ) wrapper = ReactTooltip . supportedWrappers [ 'div' ]
441+
431442 if ( html ) {
432443 return (
433- < div className = { `${ tooltipClass } ${ extraClass } ` }
444+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
434445 { ...ariaProps }
435446 data-id = 'tooltip'
436- dangerouslySetInnerHTML = { { __html : placeholder } } > </ div >
447+ dangerouslySetInnerHTML = { { __html : placeholder } } > </ wrapper >
437448 )
438449 } else {
439450 return (
440- < div className = { `${ tooltipClass } ${ extraClass } ` }
451+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
441452 { ...ariaProps }
442- data-id = 'tooltip' > { placeholder } </ div >
453+ data-id = 'tooltip' > { placeholder } </ wrapper >
443454 )
444455 }
445456 }
You can’t perform that action at this time.
0 commit comments