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 {
4444 afterHide : PropTypes . func ,
4545 disable : PropTypes . bool ,
4646 scrollHide : PropTypes . bool ,
47- resizeHide : PropTypes . bool
47+ resizeHide : PropTypes . bool ,
48+ wrapper : PropTypes . string
4849 } ;
4950
5051 static defaultProps = {
51- resizeHide : true
52+ resizeHide : true ,
53+ wrapper : 'div'
54+ } ;
55+
56+ static supportedWrappers = {
57+ 'div' : div ,
58+ 'span' : span
5259 } ;
5360
5461 constructor ( props ) {
@@ -417,18 +424,22 @@ class ReactTooltip extends Component {
417424 { 'type-info' : this . state . type === 'info' } ,
418425 { 'type-light' : this . state . type === 'light' }
419426 )
427+
428+ let wrapper = ReactTooltip . supportedWrappers [ this . props . wrapper ]
429+ if ( ! wrapper ) wrapper = div
430+
420431 if ( html ) {
421432 return (
422- < div className = { `${ tooltipClass } ${ extraClass } ` }
433+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
423434 { ...ariaProps }
424435 data-id = 'tooltip'
425- dangerouslySetInnerHTML = { { __html : placeholder } } > </ div >
436+ dangerouslySetInnerHTML = { { __html : placeholder } } > </ wrapper >
426437 )
427438 } else {
428439 return (
429- < div className = { `${ tooltipClass } ${ extraClass } ` }
440+ < wrapper className = { `${ tooltipClass } ${ extraClass } ` }
430441 { ...ariaProps }
431- data-id = 'tooltip' > { placeholder } </ div >
442+ data-id = 'tooltip' > { placeholder } </ wrapper >
432443 )
433444 }
434445 }
You can’t perform that action at this time.
0 commit comments