Skip to content

Commit

Permalink
feat(tooltip): enhance tooltip functionality with collision handling
Browse files Browse the repository at this point in the history
Added collision handling to the TooltipContent component by introducing collisionPadding and avoidCollisions properties. This improvement ensures better positioning and visibility of tooltips, enhancing the overall user experience.
  • Loading branch information
kWAYTV committed Dec 11, 2024
1 parent 09df1cf commit 76aa16b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const TooltipContent = React.forwardRef<
<TooltipPrimitive.Content
ref={ref}
sideOffset={sideOffset}
collisionPadding={8}
avoidCollisions={true}
className={cn(
'z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
className
Expand Down

0 comments on commit 76aa16b

Please sign in to comment.