【发布时间】:2021-01-14 04:22:23
【问题描述】:
【问题讨论】:
-
看看包
shinyWidgets和radioGroupButtonshere
标签: r shiny shinydashboard
【问题讨论】:
shinyWidgets和radioGroupButtonshere
标签: r shiny shinydashboard
使用包 shinyWidgets 和一点 CSS,您可以达到相同的效果:
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
tags$h1("Active background color for radioGroupButtons"),
tags$style(
".btn-custom.active, .btn-custom:active, .btn-custom:focus, .btn-custom:hover {
background: #4B088A !important;
color: #FFF !important;
}",
".btn-custom {border-color: #4B088A; color: #4B088A; background: #FFF;}"
),
radioGroupButtons(
inputId = "somevalue",
label = NULL,
choices = c("All cases", "Active cases"),
status = "custom"
),
verbatimTextOutput("value")
)
server <- function(input, output) {
output$value <- renderPrint({ input$somevalue })
}
shinyApp(ui, server)
【讨论】:
这很可能是一个带有 CSS 样式的 radioButtons 元素。以下是如何将这种格式应用于单选按钮的示例:https://stackoverflow.com/a/4642152/14327549
【讨论】: