Skip to content

Commit eb6cd02

Browse files
committed
fix(tooltip): fix the prop passing for Tooltip root
Some of the props should have been passed to the Root but were going through to the content. fix #215
1 parent 8e02d41 commit eb6cd02

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

src/components/Tooltip/Tooltip.stories.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { Meta } from '@storybook/react'
12
import React from 'react'
2-
import { Story, Meta } from '@storybook/react'
33
import { Tooltip } from '.'
4-
import { Button, Box, Flex } from '../../'
4+
import { Box, Button, Flex } from '../../'
55
import { Check } from '../Icons'
66

77
export default {
@@ -96,6 +96,23 @@ export const Multiline = () => (
9696
</Tooltip>
9797
)
9898

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+
99116
/**
100117
* By default the tooltip is rendered using a react portal. However, this can cause issues in rare circumstances.
101118
*

src/components/Tooltip/Tooltip.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ export const Tooltip: FC<TooltipProps> = ({
4545
content,
4646
open,
4747
defaultOpen,
48+
delayDuration,
49+
skipDelayDuration,
4850
onOpenChange,
4951
multiline,
5052
side = 'top',
5153
align = 'center',
5254
...props
5355
}) => (
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+
>
5563
<Trigger as={Slot}>{children}</Trigger>
5664
<StyledContent
5765
side={side}

0 commit comments

Comments
 (0)