Skip to content

How to access a ui.image component inside a side_panel? #2338

Answered by mtanco
junioraze asked this question in Q&A
Discussion options

You must be logged in to vote

Here are two ways you can do it: Use the image object and update the location in the side panel or you can use markup in an text instead.

from h2o_wave import main, app, Q, ui, run_on, on


@app('/')
async def serve(q: Q):

    q.page["meta"] = ui.meta_card(
        box="",
        layouts=[
            ui.layout(breakpoint="xs", zones=[ui.zone("all")])
        ]
    )

    q.page["meta"].side_panel = ui.side_panel(
        title="Demo",
        items=[
            ui.text("hello there"),
            ui.image(width="100px", path="https://cdn.britannica.com/79/232779-050-6B0411D7/German-Shepherd-dog-Alsatian.jpg", title="dog"),
            ui.text(name="dog_image", content="<img src='https…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@junioraze
Comment options

@mtanco
Comment options

mtanco Jun 11, 2024
Collaborator

Answer selected by junioraze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants