Shiny:使用 bslib 避免双滚动条

问题描述 投票:0回答:1

我有一个

shiny
应用程序,其中有一些选择器,有 100 多个选择。当我打开一个选择器时,我会看到 2 个滚动条,但在我看来,一个就足够了。我怎样才能避免这种情况?

library(shiny)
library(bslib)

ui <- page_fillable(
  layout_sidebar(
    sidebar = sidebar(
    pickerInput("a", label = "Select", choices = c(LETTERS, LETTERS)),
    pickerInput("a", label = "Select", choices = c(LETTERS, LETTERS)),
    pickerInput("a", label = "Select", choices = c(LETTERS, LETTERS)),
    pickerInput("a", label = "Select", choices = c(LETTERS, LETTERS))
    )
  )
  
)

server <- function(input, output, session) {
  
}

shinyApp(ui, server)

enter image description here

r shiny bslib
1个回答
0
投票

一个潜在的解决方案可能是使用选项中的尺寸选项

pickerInput
:

library(bslib)
library(shinyWidgets)
library(shiny)

ui <- page_fillable(
    layout_sidebar(
        sidebar = sidebar(
            pickerInput("a", label = "Select", choices = c(LETTERS, LETTERS), options = list(size = 10)),
            pickerInput("b", label = "Select", choices = c(LETTERS, LETTERS), options = list(size = 10)),
            pickerInput("c", label = "Select", choices = c(LETTERS, LETTERS), options = list(size = 10)),
            pickerInput("d", label = "Select", choices = c(LETTERS, LETTERS), options = list(size = 10))
        )
    )
)

server <- function(input, output, session) {
    
}

shinyApp(ui, server)
© www.soinside.com 2019 - 2024. All rights reserved.