@@ -5,6 +5,7 @@ import * as React from 'react';
5
5
import { forwardRef , useImperativeHandle , useRef } from 'react' ;
6
6
import { placements } from './placements' ;
7
7
import Popup from './Popup' ;
8
+ import classNames from 'classnames' ;
8
9
9
10
export interface TooltipProps
10
11
extends Pick <
@@ -42,6 +43,18 @@ export interface TooltipProps
42
43
id ?: string ;
43
44
overlayInnerStyle ?: React . CSSProperties ;
44
45
zIndex ?: number ;
46
+ styles ?: TooltipStyles ;
47
+ classNames ?: TooltipClassNames ;
48
+ }
49
+
50
+ export interface TooltipStyles {
51
+ root ?: React . CSSProperties ;
52
+ inner ?: React . CSSProperties ;
53
+ }
54
+
55
+ export interface TooltipClassNames {
56
+ root ?: string ;
57
+ inner ?: string ;
45
58
}
46
59
47
60
export interface TooltipRef extends TriggerRef { }
@@ -70,6 +83,8 @@ const Tooltip = (props: TooltipProps, ref: React.Ref<TooltipRef>) => {
70
83
overlay,
71
84
id,
72
85
showArrow = true ,
86
+ classNames : tooltipClassNames ,
87
+ styles : tooltipStyles ,
73
88
...restProps
74
89
} = props ;
75
90
@@ -82,14 +97,20 @@ const Tooltip = (props: TooltipProps, ref: React.Ref<TooltipRef>) => {
82
97
}
83
98
84
99
const getPopupElement = ( ) => (
85
- < Popup key = "content" prefixCls = { prefixCls } id = { id } overlayInnerStyle = { overlayInnerStyle } >
100
+ < Popup
101
+ key = "content"
102
+ prefixCls = { prefixCls }
103
+ id = { id }
104
+ innerClassName = { tooltipClassNames ?. inner }
105
+ overlayInnerStyle = { { ...overlayInnerStyle , ...tooltipStyles ?. inner } }
106
+ >
86
107
{ overlay }
87
108
</ Popup >
88
109
) ;
89
110
90
111
return (
91
112
< Trigger
92
- popupClassName = { overlayClassName }
113
+ popupClassName = { classNames ( overlayClassName , tooltipClassNames ?. root ) }
93
114
prefixCls = { prefixCls }
94
115
popup = { getPopupElement }
95
116
action = { trigger }
@@ -106,7 +127,7 @@ const Tooltip = (props: TooltipProps, ref: React.Ref<TooltipRef>) => {
106
127
defaultPopupVisible = { defaultVisible }
107
128
autoDestroy = { destroyTooltipOnHide }
108
129
mouseLeaveDelay = { mouseLeaveDelay }
109
- popupStyle = { overlayStyle }
130
+ popupStyle = { { ... overlayStyle , ... tooltipStyles ?. root } }
110
131
mouseEnterDelay = { mouseEnterDelay }
111
132
arrow = { showArrow }
112
133
{ ...extraProps }
0 commit comments