Learn R Programming

shinyMobile (version 0.8.0)

f7Menu: Framework7 menu container

Description

f7Menu is a container for f7MenuItem and/or f7MenuDropdown.

f7MenuItem creates a special action button for f7Menu.

f7MenuDropdown creates a dropdown menu for f7Menu.

f7MenuDropdownDivider creates a dropdown divider for f7MenuDropdown.

updateF7MenuDropdown toggles f7MenuDropdown on the client.

Usage

f7Menu(...)

f7MenuItem(inputId, label)

f7MenuDropdown(..., id = NULL, label, side = c("left", "center", "right"))

f7MenuDropdownDivider()

updateF7MenuDropdown(id, session = shiny::getDefaultReactiveDomain())

Arguments

inputId

Menu item input id.

label

Button label.

id

Menu to target.

side

Dropdown opening side. Choose among c("left", "center", "right").

session

Shiny session object.

Examples

Run this code
# NOT RUN {
# Menu container
if (interactive()) {
 library(shiny)
 library(shinyMobile)
 shinyApp(
  ui = f7Page(
    title = "Menus",
    f7SingleLayout(
      navbar = f7Navbar(
        title = "f7Menu",
        hairline = FALSE,
        shadow = TRUE
      ),
      f7Button(inputId = "toggle", label = "Toggle menu"),
      f7Menu(
        f7MenuDropdown(
          id = "menu1",
          label = "Menu 1",
          f7MenuItem(inputId = "item1", "Item 1"),
          f7MenuItem(inputId = "item2", "Item 2"),
          f7MenuDropdownDivider(),
          f7MenuItem(inputId = "item3", "Item 3")
        )
      )
    )
  ),
  server = function(input, output, session) {
    observeEvent(input$toggle, {
      openF7MenuDropdown("menu1")
    })

    observeEvent(input$item1, {
      f7Notif(text = "Well done!")
    })

    observe({
      print(input$item1)
      print(input$menu1)
    })
  }
 )
}
# }

Run the code above in your browser using DataLab