如何在 radioGroupButtons 的按钮之间获得更多 space 并包含图标
How to get more space between buttons of radioGroupButtons and to include icons
我正在使用带有选项 individual = TRUE 的 shinyWidgets 包的 'radioGroupButtons'。按钮紧密并排放置。
我有两个问题。
是否可以在按钮之间获得更多 space?
是否也可以让按钮标签前面有一个图标(Glyphicon、Font Awesome)?
如果是这样就好了:
我的代码如下:
library(shiny)
library(shinyjs)
library(shinyWidgets)
ui <- fluidPage(
useShinyjs(),
radioGroupButtons(
inputId = "id000",
label = NULL,
choices = c("Text", "File", "Web"),
individual = TRUE,
selected = character(0))
)
server <- function(input, output, session)
{
observeEvent(input$id000, alert(input$id000), ignoreInit = TRUE)
}
shinyApp(ui = ui, server = server)
这应该有效:
library(shiny)
library(shinyjs)
library(shinyWidgets)
ui <- fluidPage(
useShinyjs(),
tags$head(tags$style('.btn-group{ margin-left: 15px;}')), # add the spacing
icon(NULL), # need a call to icon to attach some dependencies; probably a better solution exists
radioGroupButtons(
inputId = "id000",
label = NULL,
choices = c(`<i class='fas fa-font'></i> Text` = "Text",
`<i class='far fa-file-alt'></i> File` = "File",
`<i class='fas fa-globe-americas'></i> Web` = "Web"),
individual = TRUE,
selected = character(0))
)
server <- function(input, output, session)
{
observeEvent(input$id000, alert(input$id000), ignoreInit = TRUE)
}
shinyApp(ui = ui, server = server)
要查找更多图标,请查看 ?icon
中的链接。
我正在使用带有选项 individual = TRUE 的 shinyWidgets 包的 'radioGroupButtons'。按钮紧密并排放置。
我有两个问题。 是否可以在按钮之间获得更多 space? 是否也可以让按钮标签前面有一个图标(Glyphicon、Font Awesome)?
如果是这样就好了:
我的代码如下:
library(shiny)
library(shinyjs)
library(shinyWidgets)
ui <- fluidPage(
useShinyjs(),
radioGroupButtons(
inputId = "id000",
label = NULL,
choices = c("Text", "File", "Web"),
individual = TRUE,
selected = character(0))
)
server <- function(input, output, session)
{
observeEvent(input$id000, alert(input$id000), ignoreInit = TRUE)
}
shinyApp(ui = ui, server = server)
这应该有效:
library(shiny)
library(shinyjs)
library(shinyWidgets)
ui <- fluidPage(
useShinyjs(),
tags$head(tags$style('.btn-group{ margin-left: 15px;}')), # add the spacing
icon(NULL), # need a call to icon to attach some dependencies; probably a better solution exists
radioGroupButtons(
inputId = "id000",
label = NULL,
choices = c(`<i class='fas fa-font'></i> Text` = "Text",
`<i class='far fa-file-alt'></i> File` = "File",
`<i class='fas fa-globe-americas'></i> Web` = "Web"),
individual = TRUE,
selected = character(0))
)
server <- function(input, output, session)
{
observeEvent(input$id000, alert(input$id000), ignoreInit = TRUE)
}
shinyApp(ui = ui, server = server)
要查找更多图标,请查看 ?icon
中的链接。