How to automatically grow elements when others are hidden? #5415
schroederjoa
started this conversation in
Show and tell
Replies: 1 comment 1 reply
-
|
Nice, @schroederjoa! We can simplify it a bit: switch = ui.switch('toggle blue boxes', value=True)
with ui.row().classes('size-50 items-stretch'):
ui.label().classes('grow bg-blue').bind_visibility_from(switch, 'value')
ui.label().classes('grow bg-orange')
ui.label().classes('grow bg-green')
with ui.column().classes('size-50 items-stretch'):
ui.label().classes('grow bg-blue').bind_visibility_from(switch, 'value')
ui.label().classes('grow bg-orange')
ui.label().classes('grow bg-green')
The class "items-stretch" lets all child element fill space across the principal axis (height for The latter could be replaced with the class "[&>]:grow" on a container, which applies to all its children ("&>"). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
I recently hat an issue with a lightweight-charts integration, related to resizing of elements and overflow. Falko was so kind and helped me with it, see #5400
In this context, the question came up how I can grow elements, and make them use all available space, once other elements (like a menubar) are hidden. I ended up using the following solution, which may help others with similar questions:
Beta Was this translation helpful? Give feedback.
All reactions