A few weeks ago I started writing a custom component that allows to dynamically display a list of other elements. One of its features shows a list up or down, according to the space available in the viewport (or screen).
#html 

How to Draw Dynamically Up/Down in HTML
1.40 GEEK