Hack: Showing dropdown on top of select input
See original GitHub issueSaw some issues on this topic, but no activity or merged PRs. Here’s a quick hack you can do to get the dropdown menu going in the up direction. Paste the following into your CSS file. Wrap your <Select />
component in a div with the select-up
class included.
.select-up .Select-menu-outer {
position: absolute !important;
top: auto !important;
bottom: calc(100% - 1px) !important;
border-bottom-left-radius: 0px !important;
border-bottom-right-radius: 0px !important;
border-top-left-radius: 5px !important;
border-top-right-radius: 5px !important;
}
.select-up .is-open .Select-control {
border-top-right-radius: 0 !important;
border-top-left-radius: 0 !important;
border-bottom-right-radius: 5px !important;
border-bottom-left-radius: 5px !important;
}
Example Usage:
<div className="select-up">
<Select />
</div>
Preview:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:49
- Comments:9 (1 by maintainers)
Top Results From Across the Web
HTML Select Drop Down Option Z-index - css - Stack Overflow
Open select dropdown options; Same time hover on navigation menu items; Now the navigation items are going behind the option list (not behind...
Read more >Quick Tip: CSS Only Dropdowns With The Checkbox Hack
In this quick tip, we are going to take a look at a CSS only technique for creating dropdowns. It revolves around the...
Read more >Line-by-line: advanced CSS tricks for click-to-open drop-down ...
To make the box open when the top content is clicked, you need to add the dropdown class to the combobox , and...
Read more >Dropdowns - Bootstrap
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They're made interactive with the included Bootstrap dropdown ...
Read more >Solved with CSS! Dropdown Menus
A common UI pattern that we see on the web are dropdown menus. They're used to display related information in pieces, without overwhelming...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
add to <select /> menuPlacement = “top”
Hi, based on your idea with the CSS modification I created a quick-and-dirty wrapper component that performs some DOM node calculations and tries to estimate the visual height of the menu. When this estimate fits into the screen below the select element, the overlay is displayed below it, otherwise it is displayed above the select element.
https://gist.github.com/MartinHaeusler/6dfc3769df20f534a150efda39573f0d
This is really dirty stuff, but it “works for me”. If you use different font heights etc. then you might need to adjust the constants.
This functionality (not my implementation of it, mind you) desperately needs to be part of
react-select
.