Skip to content

How to ensure tooltip stays in browser visible area? #1133

Answered by gabrieljablonski
NashL asked this question in Q&A
Discussion options

You must be logged in to vote

Try something like this

.react-tooltip {
  max-width: calc(100vw - 54px);
  word-break: break-all;
}

You might want to play around with the word-break attribute, but the max-width should be good.

By my calculations, it should actually be 42px, since there's an internal padding of 16px on each side, plus a 5px minimum margin from the page border, but for some reason that's not enough.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@gabrieljablonski
Comment options

@NashL
Comment options

@gabrieljablonski
Comment options

Answer selected by NashL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants