Skip to content

Commit

Permalink
auto arrow offset
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsnes committed Oct 23, 2024
1 parent 7d0b9e8 commit 4e34a35
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
placement,
whileElementsMounted: autoUpdate,
middleware: [
offset(ARROW_HEIGHT + ARROW_GAP),
offset((data) => {
// get pseudo element arrow size
const styles = getComputedStyle(data.elements.floating, '::before');
return parseFloat(styles.height);
}),
flip({
fallbackAxisSideDirection: 'start',
}),
Expand Down

0 comments on commit 4e34a35

Please sign in to comment.