Skip to content

Commit 2e6291c

Browse files
jpranaysgabrieljablonski
authored andcommitted
Feature : defaultIsOpen is added
1 parent 6d2a880 commit 2e6291c

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/components/Tooltip/Tooltip.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const Tooltip = ({
5656
content,
5757
contentWrapperRef,
5858
isOpen,
59+
defaultIsOpen = false,
5960
setIsOpen,
6061
activeAnchor,
6162
setActiveAnchor,
@@ -769,6 +770,9 @@ const Tooltip = ({
769770
}, [anchorId, anchorsBySelect, activeAnchor])
770771

771772
useEffect(() => {
773+
if (defaultIsOpen) {
774+
handleShow(true)
775+
}
772776
return () => {
773777
if (tooltipShowDelayTimerRef.current) {
774778
clearTimeout(tooltipShowDelayTimerRef.current)

src/components/Tooltip/TooltipTypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export interface ITooltip {
146146
style?: CSSProperties
147147
position?: IPosition
148148
isOpen?: boolean
149+
defaultIsOpen?: boolean
149150
setIsOpen?: (value: boolean) => void
150151
afterShow?: () => void
151152
afterHide?: () => void

src/components/TooltipController/TooltipController.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
5353
style,
5454
position,
5555
isOpen,
56+
defaultIsOpen = false,
5657
disableStyleInjection = false,
5758
border,
5859
opacity,
@@ -354,6 +355,7 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
354355
style,
355356
position,
356357
isOpen,
358+
defaultIsOpen,
357359
border,
358360
opacity,
359361
arrowColor,

src/components/TooltipController/TooltipControllerTypes.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export interface ITooltipController {
8080
style?: CSSProperties
8181
position?: IPosition
8282
isOpen?: boolean
83+
defaultIsOpen?: boolean
8384
disableStyleInjection?: boolean | 'core'
8485
/**
8586
* @description see https://developer.mozilla.org/en-US/docs/Web/CSS/border.

0 commit comments

Comments
 (0)