在R Shiny中,可以使用here中的选项inline = TRUE
来水平显示单选按钮,有没有办法通过shinymaterial package使用material_radio_button
来做到这一点?
我尝试使用inline = TRUE
并收到错误消息unused argument (inline = TRUE)
答案 0 :(得分:0)
library(shiny)
library(shinymaterial)
ui <- fluidPage(
material_radio_button(
input_id = "example_radio_button",
label = "Radio Button",
choices = c(
"Cake" = "c",
"Pie" = "p",
"Brownie" = "b"
),
color = "#ef5350"
),
tagList(
tags$head(
tags$style(
"#example_radio_button {display: flex;}"
)
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
您可以尝试display: flex;
或将flex
替换为-webkit-box
,-webkit-inline-box
或inline-flex
。
更新
这看起来更好:
library(shiny)
library(shinymaterial)
ui <- fluidPage(
tags$h5(tags$b('Radio Button')),
material_radio_button(
input_id = "example_radio_button",
label = "",
choices = c(
"Cake" = "c",
"Pie" = "p",
"Brownie" = "b"
),
color = "#ef5350"
),
tagList(
tags$head(
tags$style(
"#example_radio_button {display: flex;}
input[type=radio] {margin-left: 10px;}"
)
)
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)