8000 feat(CTooltip): add `onHide` and `onShow` event · v-rr/coreui-react@d4d4b04 · GitHub
[go: up one dir, main page]

Skip to content

Commit d4d4b04

Browse files
committed
feat(CTooltip): add onHide and onShow event
1 parent 88b5ed2 commit d4d4b04

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/components/tooltip/CTooltip.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ export interface CTooltipProps {
1313
* Content node for your component.
1414
*/
1515
content: ReactNode
16+
/**
17+
* Callback fired when the component requests to be hidden.
18+
*/
19+
onHide?: () => void
20+
/**
21+
* Callback fired when the component requests to be shown.
22+
*/
23+
onShow?: () => void
1624
/**
1725
* Sets which event handlers you’d like provided to your toggle prop. You can specify one trigger or an array of them.
1826
*
@@ -32,6 +40,8 @@ export interface CTooltipProps {
3240
export const CTooltip: FC<CTooltipProps> = ({
3341
children,
3442
placement = 'top',
43+
onHide,
44+
onShow,
3545
trigger = 'hover',
3646
visible,
3747
...rest
@@ -76,6 +86,8 @@ export const CTooltip: FC<CTooltipProps> = ({
7686
enter: 0,
7787
exit: 200,
7888
}}
89+
onEnter={onShow}
90+
onExit={onHide}
7991
mountOnEnter
8092
unmountOnExit
8193
>
@@ -106,6 +118,8 @@ export const CTooltip: FC<CTooltipProps> = ({
106118
CTooltip.propTypes = {
107119
children: PropTypes.any,
108120
placement: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
121+
onHide: PropTypes.func,
122+
onShow: PropTypes.func,
109123
trigger: triggerPropType,
110124
visible: PropTypes.bool,
111125
}

0 commit comments

Comments
 (0)
0