在一个闪亮的应用程序中,是否有办法防止selectInput()中下拉文本的包装,如下面的屏幕截图所示?每个选项都是一个长文本字符串。我希望下拉列表在一行上显示每条长字符串,而不会产生巨大的侧边栏。

发布于 2016-05-11 00:23:53
从here和here中获得灵感,您可以在昏睡中添加一些自定义css
下面是一个有用的例子
library(shiny)
server <- function(input, output) {
output$distPlot <- renderPlot({
hist(rnorm(input$obs), col = 'darkgray', border = 'white')
})
}
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
sliderInput("obs", "Number of observations:", min = 10, max = 500, value = 100),
selectizeInput(inputId = "si",
label = "select",
choices = c("the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog"),
selected = NULL),
## Custom css
tags$head(
tags$style(HTML('
.selectize-input {
white-space: nowrap;
}
.selectize-dropdown {
width: 660px !important;
}'
)
)
)
),
mainPanel(plotOutput("distPlot"))
)
)
shinyApp(ui = ui, server = server)

发布于 2020-12-04 16:31:17
如果你做了selectize=False,在
selectInput(id="id",label="label",choices=your_choices, selectize=False)
它不会包装在你的文本上。
https://stackoverflow.com/questions/37150726
复制相似问题