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

[express]: how to put a sidebar in a navset_card_tab() context manager? #1507

Open
Damonsoul opened this issue Jul 9, 2024 · 1 comment
Open

Comments

@Damonsoul
Copy link

Damonsoul commented Jul 9, 2024

With Shiny Core, you can create an app with this layout using the following code:

from shiny import App, ui

ui = ui.page_fluid(ui.navset_card_tab(
    ui.nav_panel("A", "Panel A content"),
    ui.nav_panel("B", "Panel B content"),
    title="Card with navbar",
    sidebar=ui.sidebar(
        ui.input_select("data", "Data", ("A", "B", "C"))
    ),
))

def server(input):
    pass

app = App(ui, server)

But when I try it in shiny.express using the following code it doesn't work

from shiny.express import ui
ui.page_opts(fillable=True)

with ui.navset_card_tab(title="Card with navbar"):  
    with ui.sidebar():
        ui.input_select("data", "Data", ("A", "B", "C"))
    with ui.nav_panel("A"):
        "Panel A content"
    with ui.nav_panel("B"):
        "Panel B content"
@cpsievert
Copy link
Collaborator

We will hopefully support that usage (of with ui.sidebar() inside with ui.navset_card_tab()), but in the meantime, you can workaround the limitation by passing a sidebar object to the sidebar keyword parameter

@cpsievert cpsievert changed the title navset_card_tab with same sidebar in shiny.express [express]: how to put a sidebar in a navset_card_tab() context manager? Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants