首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >增加selectinput的高度

增加selectinput的高度
EN

Stack Overflow用户
提问于 2019-10-30 01:48:09
回答 1查看 176关注 0票数 0

有没有办法通过增加selectInput()的高度来扩大它的大小?基本上,我希望显示所有可用的选项,并使selectinput框更大。

代码语言:javascript
复制
#ui.r
fluidPage(

  # Copy the line below to make a select box 
  selectInput("select", label = h3("Select box"), 
    choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), 
    selected = 1),

  hr(),
  fluidRow(column(3, verbatimTextOutput("value")))

)
#server.r
function(input, output) {

  # You can access the value of the widget with input$select, e.g.
  output$value <- renderPrint({ input$select })

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-30 01:58:52

你可以使用下面的代码,如果这个方法有效的话,你可以尝试一下:

代码语言:javascript
复制
library(shiny)

    ui <- fluidPage(
      fluidRow(

        selectInput("distance", label=NULL, choices = list("1" = 1, "2" = 2), selected = 1),
        tags$head(tags$style(HTML(".selectize-input {height: 150px; width: 550px; font-size: 50px;}")))
      )

)
server <- function(input, output){}
shinyApp(ui, server)

您可以在此处将selectInput的大小设置为heightwidth

使用checkboxGroupInput:

代码语言:javascript
复制
library(shiny)

ui<-fluidPage(

    # Copy the line below to make a select box 
    checkboxGroupInput("select", label = h3("Select box"), 
                choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), 
                selected = 1),

    hr(),
    fluidRow(column(3, verbatimTextOutput("value")))

  )
  #server.r
 server<- function(input, output) {

    # You can access the value of the widget with input$select, e.g.
    output$value <- renderPrint({ input$select })

  }

shinyApp(ui, server)

使用radioButton:

代码语言:javascript
复制
ui<-fluidPage(

    # Copy the line below to make a select box 
    radioButtons("select", label = h3("Select box"), 
                choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), 
                selected = 1),

    hr(),
    fluidRow(column(3, verbatimTextOutput("value")))

  )
  #server.r
 server<- function(input, output) {

    # You can access the value of the widget with input$select, e.g.
    output$value <- renderPrint({ input$select })

  }

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

https://stackoverflow.com/questions/58612896

复制
相关文章

相似问题

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