f7Checkbox | R Documentation |
f7Checkbox creates a checkbox input.
updateF7Checkbox
changes the value of a checkbox input on the client.
f7Checkbox(inputId, label, value = FALSE) updateF7Checkbox( inputId, label = NULL, value = NULL, session = shiny::getDefaultReactiveDomain() )
inputId |
The id of the input object. |
label |
The label to set for the input object. |
value |
The value to set for the input object. |
session |
The Shiny session object. |
if(interactive()){ library(shiny) library(shinyMobile) shinyApp( ui = f7Page( title = "My app", f7SingleLayout( navbar = f7Navbar(title = "f7Checkbox"), f7Card( f7Checkbox( inputId = "check", label = "Checkbox", value = FALSE ), verbatimTextOutput("test") ) ) ), server = function(input, output) { output$test <- renderPrint({input$check}) } ) } if (interactive()) { library(shiny) library(shinyMobile) ui <- f7Page( f7SingleLayout( navbar = f7Navbar(title = "updateF7CheckBox"), f7Slider( inputId = "controller", label = "Number of observations", max = 10, min = 0, value = 1, step = 1, scale = TRUE ), f7checkBox( inputId = "check", label = "Checkbox" ) ) ) server <- function(input, output, session) { observe({ # TRUE if input$controller is odd, FALSE if even. x_even <- input$controller %% 2 == 1 if (x_even) { showNotification( id = "notif", paste("The slider is ", input$controller, "and the checkbox is", input$check), duration = NULL, type = "warning" ) } else { removeNotification("notif") } updateF7Checkbox("check", value = x_even) }) } shinyApp(ui, server) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.