Hi,
I am having some issues using flexbox to build a customized UI element. Here’s the background. I would like to create a chat-like interface with an input field at the bottom. This input field would extend if a button is clicked and the list of messages above should shrink.
My idea is to implement this with flexbox much like this CodePen where only the wrapper is assigned a height and the remaining elements set their heights themselves. If the lower element grows (by click of the button), the upper element shrinks. This seems to work fine.
I tried to replicate the same behavior in Anvil using a dummy app. I created a column panel for wrapper, upper and lower and assigned them custom roles with custom CSS:
.anvil-role-wrapper {
height:600px;
min-height:600px;
overflow-y: hidden;
margin: 100px;
background-color:green;
display:flex;
flex-direction:column;
border: 5px solid black
}
.anvil-role-upper{
height:auto;
background-color:blue;
flex-grow: 60;
}
.anvil-role-lower{
height:200px;
background-color:red;
}
Weirdly, they behave quite differently: Upper doesn’t grow at all (which makes it impossible to test its shrinking behavior). Am I doing something wrong or is there a workaround for this problem?
Here’s a link to my test app: https://anvil.works/ide#clone:XZOTNZATQ364JVQI=IWL2Y7TBOSA4JVGSDRJ74HBW