Learn R Programming

shinyMobile (version 0.7.0)

f7InsertTab: Insert a f7Tab in a f7Tabs

Description

Insert a f7Tab in a f7Tabs

Usage

f7InsertTab(
  inputId,
  tab,
  target,
  position = c("before", "after"),
  select = FALSE,
  session = shiny::getDefaultReactiveDomain()
)

Arguments

inputId

f7Tabs id.

tab

f7Tab to insert.

target

f7Tab after of before which the new tab will be inserted.

position

Insert before or after: c("before", "after").

select

Whether to select the newly inserted tab. FALSE by default.

session

Shiny session object.

Examples

Run this code
# NOT RUN {
if (interactive()) {
 library(shiny)
 library(shinyMobile)
 shiny::shinyApp(
   ui = f7Page(
     title = "Insert a tab Before the target",
     f7TabLayout(
       panels = tagList(
         f7Panel(title = "Left Panel", side = "left", theme = "light", "Blabla", effect = "cover"),
         f7Panel(title = "Right Panel", side = "right", theme = "dark", "Blabla", effect = "cover")
       ),
       navbar = f7Navbar(
         title = "Tabs",
         hairline = FALSE,
         shadow = TRUE,
         left_panel = TRUE,
         right_panel = TRUE
       ),
       f7Tabs(
         animated = TRUE,
         id = "tabs",
         f7Tab(
           tabName = "Tab 1",
           icon = f7Icon("email"),
           active = TRUE,
           "Tab 1",
           f7Button(inputId = "go", label = "Go")
         ),
         f7Tab(
           tabName = "Tab 2",
           icon = f7Icon("today"),
           active = FALSE,
           "Tab 2"
         )
       )
     )
   ),
   server = function(input, output, session) {
     observeEvent(input$go, {
       f7InsertTab(
         inputId = "tabs",
         position = "before",
         target = "Tab 2",
         tab = f7Tab (tabName = paste0("tab_", input$go), "Test"),
         select = TRUE
       )
     })
   }
 )
}

# }

Run the code above in your browser using DataLab