# 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