有没有办法通过增加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 })
}发布于 2019-10-30 01:58:52
你可以使用下面的代码,如果这个方法有效的话,你可以尝试一下:
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)https://stackoverflow.com/questions/58612896
复制相似问题