是否可以通过增加selectInput()
的高度来扩展其大小?基本上,我希望所有可用的选项都显示出来,并使selectinput框变大。
#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 })
}
答案 0 :(得分:1)
您可以使用下面的方法,尝试一下是否可行:
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的大小设置为height
和width
。
带有checkboxGroupInput:
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:
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)