Learn R Programming

shinyMobile (version 0.5.0.9000)

f7Popup: Create a f7 popup

Description

Create a f7 popup

Usage

f7Popup(
  ...,
  id,
  title,
  backdrop = TRUE,
  closeByBackdropClick = TRUE,
  closeOnEscape = FALSE,
  animate = TRUE,
  swipeToClose = FALSE
)

Arguments

...

Content.

id

Popup unique id.

title

Title.

backdrop

Enables Popup backdrop (dark semi transparent layer behind). Default to TRUE.

closeByBackdropClick

When enabled, popup will be closed on backdrop click. Default to TRUE.

closeOnEscape

When enabled, popup will be closed on ESC keyboard key press. Default to FALSE.

animate

Whether the Popup should be opened/closed with animation or not. Default to TRUE.

swipeToClose

Whether the Popup can be closed with swipe gesture. Can be true to allow to close popup with swipes to top and to bottom. Default to FALSE.

Examples

Run this code
# NOT RUN {
if (interactive()) {
 library(shiny)
 library(shinyMobile)
 shiny::shinyApp(
   ui = f7Page(
     color = "pink",
     title = "My app",
     f7SingleLayout(
      navbar = f7Navbar(
        title = "f7Popup",
        hairline = FALSE,
        shadow = TRUE
      ),
      f7Button("togglePopup", "Toggle Popup"),
      f7Popup(
       id = "popup1",
       title = "My first popup",
       f7Text("text", "Popup content", "This is my first popup ever, I swear!"),
       verbatimTextOutput("popupContent")
      )
     )
   ),
   server = function(input, output, session) {

    output$popupContent <- renderPrint(input$text)

    observeEvent(input$togglePopup, {
     f7TogglePopup(id = "popup1")
    })

    observeEvent(input$popup1, {

     popupStatus <- if (input$popup1) "opened" else "closed"

     f7Toast(
      session,
      position = "top",
      text = paste("Popup is", popupStatus)
     )
    })
   }
 )
}
# }

Run the code above in your browser using DataLab