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

Dynamic left menu listing items downward instead of to the right #137

Open
sdaza opened this issue May 17, 2021 · 0 comments
Open

Dynamic left menu listing items downward instead of to the right #137

sdaza opened this issue May 17, 2021 · 0 comments

Comments

@sdaza
Copy link

sdaza commented May 17, 2021

I am trying to create a dynamic left menu (header), but the items are listed downward instead of to the right. I guess it has to do with the tagList wrapper when defining the UI.

library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(shinyWidgets)
library(stringr)


 ui = dashboardPage(
     dashboardHeader(
         leftUi =  tagList(uiOutput("filter"))
     ),
     dashboardSidebar(
         pickerInput(
                "inputParameters",
                "Parameters:",
                choices = c("a", "b", "c"),
                multiple = TRUE,
                options = list(
                    `actions-box` = TRUE,
                    size = 10,
                    `selected-text-format` = "count > 1"
                )
            )
        ),
     dashboardBody(),
     title = "DashboardPage"
)

server = function(input, output) {

    params <- reactive(input$inputParameters)
    
    output$filter = renderUI(
            lapply(seq_along(params()), function(i) {
                dropdownButton(
                    inputId = paste0("mydropdown", i),
                    label = params()[i],
                    icon = icon("sliders"),
                    status = "primary", 
                    circle = FALSE,
                    selectizeInput(
                        paste0("input", paste0(str_to_title(params()[i]))),
                        paste0(paste0(str_to_title(params()[i]), ":")),
                        choices = 1:3,
                        multiple = TRUE,
                        selected = 1:3
                    )
                )
            })
        )

}

shinyApp(ui, server)

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant