Giter VIP home page Giter VIP logo

Comments (5)

matttti avatar matttti commented on September 28, 2024 2

+1. And it would be cool to have a sort of "auto" mode which opens the menu in the direction where enough space is available. Having the component near the lower border of the viewport can result in a only partial visible menu.

from react-autocomplete.

vorlov avatar vorlov commented on September 28, 2024

+1

from react-autocomplete.

donfour avatar donfour commented on September 28, 2024

Please!
p.s. is there a way of doing it in jQuery before that happens? help!

from react-autocomplete.

CMTegner avatar CMTegner commented on September 28, 2024

Hi everyone!

You have full control over the menu's styles, so making it render on top instead of at the bottom is as simple as specifying bottom: 0; margin-bottom: -20px; (replace -20px with the height of the <input> element). If you want a more intelligent positioning logic I suggest using a lib/util such as Popper.js. Here's an example of how it could look: https://codesandbox.io/s/kxmmym9mz3 (resize the window vertically to see the menu flip when there's not enough space below, props.open is used to force the menu to stay open)

There probably won't every be support for this in Autocomplete, as we don't really want to have responsibility for things such as positioning and style.

Hope this helps!

from react-autocomplete.

mirkods avatar mirkods commented on September 28, 2024

Hi @CMTegner I followed your example with Popperjs, everything work fine but the component is not displayed and this also happens in your example if you add <Arrow className="popper__arrow" /> as a child of Popper component. Any idea?

Mirko

from react-autocomplete.

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.