| tabs | R Documentation |
This function creates a tabbed interface where each tab has dynamically generated content.
tabs(names, fun, groupname = .unique_name(), checked = 1, ...)
names |
A character vector of tab labels. |
fun |
A function that generates the content for each tab. It must take an index ('i') as the first argument. |
groupname |
A unique string to group the radio inputs (default is generated automatically). |
checked |
The index of the tab that should be pre-selected (default is '1'). |
... |
Additional arguments passed to 'fun'. |
An 'htmltools::tagList' containing the tabbed interface.
## Not run:
tab_labels <- c("Tab1", "Tab2", "Tab3")
tab_content_fun <- function(i, extra_text = "") {
htmltools::tagList(
htmltools::tags$p(paste("Content for tab:", tab_labels[i], extra_text)),
htmltools::tags$img(src = paste0("plot_", i, ".png"), width = "100%")
)
}
tabs(tab_labels, tab_content_fun, checked = 2, extra_text = "Additional details")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.