posit-dev / posit-dev/py-shiny
[express]: how to put a sidebar in a `navset_card_tab()` context manager?
Open
Nobody has claimed this yet.
needs-triage
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
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"
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shiny.express snippet and comparing it with the working Shiny Core example in the issue. Trace how navset_card_tab, sidebar, and nav_panel are composed in the Express context-manager form. Done means the Express form supports the same sidebar layout as the Core example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100