Skip to content

In express closing the sidebar programatically strips content #1071

@gshotwell

Description

@gshotwell

THe "Sidebar content" text disappears when the sidebar is programamtically opened or closed

from shiny import reactive
from shiny.express import input, render, ui

with ui.sidebar(id="sidebar"):
    "Sidebar content"

with ui.layout_columns():
    ui.input_action_button("open_sidebar", label="Open sidebar", class_="me-3")
    ui.input_action_button("close_sidebar", label="Close sidebar", class_="me-3")


@render.text
def state():
    return f"input.sidebar(): {input.sidebar()}"


@reactive.Effect
@reactive.event(input.open_sidebar)
def _():
    ui.update_sidebar("sidebar", show=True)


@reactive.Effect
@reactive.event(input.close_sidebar)
def _():
    ui.update_sidebar("sidebar", show=False)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions