Giter Site home page Giter Site logo

Comments (7)

denisborovikov avatar denisborovikov commented on May 12, 2024 2

Hi, just use tooltip as a controlled component.

Here's a rough example of how you can implement required behavior https://codesandbox.io/s/mm3klvjjjx

Use tab to switch the focus between buttons. When you focus on the middle button, tooltip shows. When the button lost the focus, it hides.

You can use tooltipShown and onVisibilityChange to control the appearance of the tooltip from the outside. See README and controlled example.

from react-popper-tooltip.

denisborovikov avatar denisborovikov commented on May 12, 2024 2

@robertkraig Here's quick rewrite with react class component https://codesandbox.io/s/jj3rm0nnmw

from react-popper-tooltip.

robertkraig avatar robertkraig commented on May 12, 2024 1

@mohsinulhaq that was exactly what I needed to see. Wish the docs where as clear as this example was.

from react-popper-tooltip.

mohsinulhaq avatar mohsinulhaq commented on May 12, 2024

@robertkraig I hope the solution worked out for your use case :)

from react-popper-tooltip.

robertkraig avatar robertkraig commented on May 12, 2024

@mohsinulhaq absolutely. I had to 1st figure out though how the whole useState stuff worked so I understood your example. I think it's still a little too pre-mature for production-level usage of useState. I know it's been out for a minute, but most people don't have the right version of react yet. Only the bleeding edge people use it atm.

from react-popper-tooltip.

denisborovikov avatar denisborovikov commented on May 12, 2024

@robertkraig I like hooks and use them in my everyday work. That's the reason why I used useState. Just because it was easier for me to prepare a quick proof of concept. You can use any state management as you want - setState, redux, recompose's useStateHandler, react-powerplug's container. It's totally up to you.

from react-popper-tooltip.

mohsinulhaq avatar mohsinulhaq commented on May 12, 2024

@robertkraig please confirm if the solution sufficed so that we can close this issue

from react-popper-tooltip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.