Description Usage Arguments Examples
Creates a multi action button for usage in a Shiny UI.
1 2 3 4 5 6 7 8 | multiActionButton(
rotate = TRUE,
bg = NULL,
fg = NULL,
icon = NULL,
direction = "right",
subButtons
)
|
rotate |
logical, whether to rotate the icon upon clicking the main button |
bg |
background color of the button |
fg |
color of the icon |
icon |
icon name |
direction |
the opening direction, |
subButtons |
a list of buttons created with |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | library(shiny)
library(shinyMultiActionButton)
ui <- fluidPage(
tags$head(
tags$style(HTML("pre {font-size: 18px; font-weight: bold;}"))
),
br(),
multiActionButton(
rotate = TRUE, bg = "darkMagenta", fg = "white",
icon = "plus", direction = "right",
subButtons = list(
subButton("user-plus", bg = "blue", icon = "user-plus", iconSize = "4x"),
subButton("library", bg = "teal", icon = "library", iconSize = "4x"),
subButton("alarm", bg = "pink", icon = "alarm", iconSize = "4x"),
subButton("power", bg = "lime", icon = "power", iconSize = "4x"),
subButton("lock", bg = "orange", icon = "lock", iconSize = "4x")
)
),
br(), br(), br(),
tags$fieldset(
tags$legend("Buttons states"),
verbatimTextOutput("buttons")
)
)
server <- function(input, output){
output[["buttons"]] <- renderPrint({
states <- c(
paste0("user-plus: ", input[["user-plus"]]),
paste0("library: ", input[["library"]]),
paste0("alarm: ", input[["alarm"]]),
paste0("power: ", input[["power"]]),
paste0("lock: ", input[["lock"]])
)
cat(states, sep = "\n")
})
}
if(interactive()){
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.