File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change
1
+ import { Meta } from '@storybook/react'
1
2
import React from 'react'
2
- import { Story , Meta } from '@storybook/react'
3
3
import { Tooltip } from '.'
4
- import { Button , Box , Flex } from '../../'
4
+ import { Box , Button , Flex } from '../../'
5
5
import { Check } from '../Icons'
6
6
7
7
export default {
@@ -96,6 +96,23 @@ export const Multiline = () => (
96
96
</ Tooltip >
97
97
)
98
98
99
+ /**
100
+ * The delay duration can be controlled
101
+ *
102
+ * - `delayDuration` - The duration from when the mouse enters the trigger until the tooltip opens.
103
+ * - `skipDelayDuration` - How much time a user has to enter another trigger without incurring a delay again.
104
+ */
105
+ export const Delay = ( ) => (
106
+ < >
107
+ < Tooltip delayDuration = { 500 } skipDelayDuration = { 0 } content = "OK" >
108
+ < Button > Delay 500ms</ Button >
109
+ </ Tooltip >
110
+ < Tooltip delayDuration = { 2000 } skipDelayDuration = { 0 } content = "OK" >
111
+ < Button css = { { ml : '$3' } } > Delay 2s</ Button >
112
+ </ Tooltip >
113
+ </ >
114
+ )
115
+
99
116
/**
100
117
* By default the tooltip is rendered using a react portal. However, this can cause issues in rare circumstances.
101
118
*
Original file line number Diff line number Diff line change @@ -45,13 +45,21 @@ export const Tooltip: FC<TooltipProps> = ({
45
45
content,
46
46
open,
47
47
defaultOpen,
48
+ delayDuration,
49
+ skipDelayDuration,
48
50
onOpenChange,
49
51
multiline,
50
52
side = 'top' ,
51
53
align = 'center' ,
52
54
...props
53
55
} ) => (
54
- < Root open = { open } defaultOpen = { defaultOpen } onOpenChange = { onOpenChange } >
56
+ < Root
57
+ open = { open }
58
+ defaultOpen = { defaultOpen }
59
+ delayDuration = { delayDuration }
60
+ skipDelayDuration = { skipDelayDuration }
61
+ onOpenChange = { onOpenChange }
62
+ >
55
63
< Trigger as = { Slot } > { children } </ Trigger >
56
64
< StyledContent
57
65
side = { side }
You can’t perform that action at this time.
0 commit comments