slmgc / react-hint

Tooltip component for React, Preact, Inferno

Home Page:https://react-hint.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`auto` position, or window-aware hints

holman opened this issue · comments

Nifty library. ✨

One thing I'm looking to do is have the hint itself be aware of its surroundings. In other words, if I have a button that opens a tooltip, and, say, that button is flush with the bottom of the page, I'd like to open the tooltip open to the top. Right now it just drops the tooltip to the bottom (if you request bottom) where you have to scroll to see it. Same idea on all the other sides, too.

Mostly asking about this because I'd really just like to toss a tooltip in with no regard to where it might be on a page. Or, put another way, I just want to open the tooltip towards whichever direction has the most space on-screen (so something riding the right hand of the screen would open to the left, etc.)

Thoughts on this? (Or, is it doable today? I've taken a peek but couldn't see anything related to this.)

Hey, thanks a lot for a suggestion. It's not doable at the moment, but it looks like a nice-to-have feature. I will look into it.

Added support for autoPosition property which handles your case.

✨ looks great, thanks!