How can I add new content to the scroll_area? #4293
-
Questionwith ui.card(align_items="stretch").classes("w-full"):
with ui.scroll_area().classes('h-32') as gift_scroll:
with ui.row():
ui.label(f"text form dict").classes("text-xl")
with ui.avatar(color="").classes("w-8 h-8"):
ui.image()
ui.label("text b").classes("text-xl")
ui.label("text form dict").classes("text-xl") What should I do when I need to add new content to the scroll_area at some point after creating an element? |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Jan 31, 2025
Replies: 1 comment 1 reply
-
Hi @SHDocter, Here is a demo for adding and removing elements dynamically: container = ui.row()
def add_face():
with container:
ui.icon('face')
add_face()
ui.button('Add', on_click=add_face)
ui.button('Remove', on_click=lambda: container.remove(0) if list(container) else None)
ui.button('Clear', on_click=container.clear) This should work for scroll areas as well. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
SHDocter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @SHDocter,
Here is a demo for adding and removing elements dynamically:
This should work for scroll areas as well.