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

navset_pill_list poorly scales screen size because of grid layout #1112

Open
corey-dawson opened this issue Feb 7, 2024 · 0 comments
Open

Comments

@corey-dawson
Copy link

The navset pill list (a vertical nav tab bar) currently uses the 12-point grid system to space the pills and the content across the screen width. This causes poor layouts and scaling based on screen size. For instance, the default width makes the navigation well panel 4/12ths of the screen (33%). This might be fine on an older monitor, however, on any new widescreen, this would make a navigation of list items take up far too much to the screen width [for a simple vertical list of nav objects]. The normal nav panels (that go across the width of the screen) dont scale height-wise when the screen is larger, so why would the vertical navigation tabset scale width wise? The current implementation creates a ton of wasted space. The function allows users to put in a tuple width (nav width, content width), where the total width has to equal 12. Even when updating this value, there will always be scaling issues

In addition, I want all my output content for each tab to take up the same height. please add a height argument into the navset_pill_list

Suggesting to change this widget to use a set width like the sidebar. However, more ideally would be use flexbot with display flex for the nav well and main content with flex values [to make this really solid, add min-width and max-width for the nav well]

Example of somewhat okay sizing for a small screen

image

same exact app on a standard widescreen monitor

image

app

from shiny import App, Inputs, Outputs, Session, reactive, render, ui

app_ui = ui.page_fluid(
    ui.navset_bar(
        ui.nav_panel(
            "Configuration",
            ui.navset_pill_list(  
                ui.nav_panel(
                    "Input Page A",
                    ui.div(
                        "Input A",
                        style="height: 90vh; background-color: green"
                    )
                ),
                ui.nav_panel("Input Page B", "Input B"),
                ui.nav_panel("Inputs Page C", "Input C"),
                id="tab",
            ) 
        ),
        ui.nav_panel(
            "Optimization",
            "Optimization Panel"
        ),
        title = "My App",
    )
)

def server(input: Inputs, output: Outputs, session: Session):
    print("do stuff")
    
app = App(app_ui, server)

Excellent way for better layout sizing

from shiny import App, Inputs, Outputs, Session, reactive, render, ui

app_ui = ui.page_fluid(
    ui.div( # row div
        ui.div( # vertical pill nav div
            "good size vertical nav tab container",
            style="flex: 1; min-width: 230px; max-width: 285px; background-color: gray; border-style: solid; text-align: center"
        ),
        ui.div( # pill content div
            "main content here",
            style="flex: 3; text-align: center"
        ),
        style="display: flex; flex-direction: row; height: 100vh; width: 100%;"
    )
)

def server(input: Inputs, output: Outputs, session: Session):
    print("do stuff")
    
app = App(app_ui, server)
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

1 participant