How to properly vertically stretch items within a grid? #4612
-
First Check
Example Codedef echarts_page():
data = {
"xAxis": {"type": "value"},
"yAxis": {"type": "category", "data": ["A", "B"], "inverse": True},
"legend": {"textStyle": {"color": "gray"}},
"series": [
{"type": "bar", "name": "Alpha", "data": [0.1, 0.2]},
{"type": "bar", "name": "Beta", "data": [0.3, 0.4]},
],
}
with ui.grid(columns=2).classes("w-full h-screen gap-0"):
for _ in range(6):
ui.echart(data).classes("h-auto") DescriptionI'm struggling to understand how to vertical stretch properly with NiceGUI Version2.14.1 Python VersionPython 3.12.9 BrowserEdge Operating SystemLinux Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 8 replies
-
I don't have a computer, but I'm pretty sure you have to Get familiar with Tailwind CSS classes with regards to "flex" layout. They are what you want when you want, say, it to fill remaining space. If in doubt, you can ask ChatGPT. It's pretty good at it. Prompt wise, no need to explain NiceGUI to it. Just say it's a "Python wrapper for Tailwind CSS, Quasar components, and Apache EChart" |
Beta Was this translation helpful? Give feedback.
-
Sorry I mistakenly put 'horizontally' when I meant 'vertically'. The width is stretching fine, just not the height. I tried |
Beta Was this translation helpful? Give feedback.
-
Ah! Recall in the chat with llm example, the dialog box for the message log expands the entire height. These two magical lines may be the reason: https://github.com/zauberzeug/nicegui/blob/main/examples%2Fchat_with_ai%2Fmain.py#L35-L36 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Oh, we can write
ui.grid(columns=2, rows=2)
to achieve equal rows and columns. 🙂