Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive binding for the columns and rows parameters of rxui.grid does not work #283

Closed
CrystalWindSnake opened this issue Dec 10, 2024 · 0 comments · Fixed by #284
Closed
Labels
bug Something isn't working

Comments

@CrystalWindSnake
Copy link
Owner

from nicegui import ui
from ex4nicegui import rxui, to_ref


columns = to_ref(1)


rxui.slider(min=0, max=10, step=1, value=columns)

# not working
with ui.card(), rxui.grid(columns=lambda: f"repeat({columns.value}, 1fr)"):
    for i in range(10):
        ui.label(f"Row {i}")

# working
with ui.card(), rxui.grid().bind_style(
    {"grid-template-columns": lambda: f"repeat({columns.value}, 1fr)"}
):
    for i in range(10):
        ui.label(f"Row {i}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant