Skip to content

Commit 4c3ff70

Browse files
committed
Allow to disable Tooltip component
1 parent 40e1d73 commit 4c3ff70

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/components/tooltip/index.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { cn } from '../../lib/utils'
55
type TooltipProps = React.ComponentProps<typeof BaseTooltip> & {
66
className?: string
77
title: React.ReactNode
8+
disabled?: boolean
89
} & Pick<React.ComponentProps<typeof TooltipContent>, 'side' | 'sideOffset' | 'align'>
910

1011
const TooltipContentNoArrow = ({
@@ -27,7 +28,20 @@ const TooltipContentNoArrow = ({
2728
)
2829
}
2930

30-
export const Tooltip = ({ className, title, children, side, sideOffset, align, ...props }: TooltipProps) => {
31+
export const Tooltip = ({
32+
className,
33+
title,
34+
children,
35+
side,
36+
sideOffset,
37+
align,
38+
disabled = false,
39+
...props
40+
}: TooltipProps) => {
41+
if (disabled) {
42+
return <>{children}</>
43+
}
44+
3145
return (
3246
<BaseTooltip {...props}>
3347
<TooltipTrigger asChild>{children}</TooltipTrigger>

0 commit comments

Comments
 (0)