bulmaSwitchInput | R Documentation |
Create a switch input https://wikiki.github.io/form/switch/.
bulmaSwitchInput(
inputId,
label = NULL,
value = FALSE,
color = NULL,
size = NULL,
style = NULL,
rtl = FALSE,
disabled = FALSE
)
inputId |
Id to access value. |
label |
Switch label. |
value |
TRUE or FALSE, FALSE by default. |
color |
Switch color : |
size |
Switch size : |
style |
Switch style : |
rtl |
Set to invert switch. |
disabled |
Set to disable switch. |
David Granjon, dgranjon@ymail.com
if(interactive()) {
library(shiny)
shinyApp(
ui = bulmaNavbarPage(
bulmaNavbar(
bulmaNavbarBrand(
bulmaNavbarItem(
"shinybulma"
),
bulmaNavbarBurger()
),
bulmaNavbarMenu( # not visible on smaller devices
bulmaNavbarItem(
"Switch Inputs"
)
)
),
bulmaNav(
"Switch Inputs",
div(style = "text-align: center;",
bulmaTitle("The plot only displays if switch 1 is TRUE.")),
br(), br(), hr(),
bulmaContainer(
bulmaColumns(
bulmaColumn(
width = 6,
bulmaSubtitle("Inputs"),
bulmaSwitchInput(
inputId = "switch1",
label = "switch 1",
value = FALSE,
color = NULL,
size = NULL,
style = NULL,
rtl = FALSE,
disabled = FALSE),
bulmaSwitchInput(
inputId = "switch2",
label = "switch 2",
value = TRUE,
color = "warning",
size = "large",
style = "rounded",
rtl = FALSE,
disabled = TRUE),
bulmaSwitchInput(
inputId = "switch3",
label = "switch 3",
value = TRUE,
color = "danger",
size = "small",
style = "thin",
rtl = FALSE,
disabled = FALSE),
bulmaSwitchInput(
inputId = "switch4",
label = "switch 4",
value = FALSE,
color = NULL,
size = NULL,
style = "mixed3",
rtl = FALSE,
disabled = FALSE)
),
bulmaColumn(
width = 6,
bulmaSubtitle("Outputs"),
plotOutput("plot1"),
uiOutput("switches")
)
)
)
)
),
server = function(input, output) {
output$plot1 <- renderPlot({
if (input$switch1 == TRUE) {
plot(mtcars$wt, mtcars$mpg)
}
})
output$switches <- renderPrint({
c(input$switch1, input$switch2, input$switch3, input$switch4)
})
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.