首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >防止selectInput包装文本

防止selectInput包装文本
EN

Stack Overflow用户
提问于 2016-05-10 23:44:09
回答 2查看 1.7K关注 0票数 4

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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-05-11 00:23:53

herehere中获得灵感,您可以在昏睡中添加一些自定义css

下面是一个有用的例子

代码语言:javascript
复制
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)

票数 1
EN

Stack Overflow用户

发布于 2020-12-04 16:31:17

如果你做了selectize=False,在

selectInput(id="id",label="label",choices=your_choices, selectize=False)

它不会包装在你的文本上。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37150726

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档