hrefTab creates a small section of link buttons

hrefTab(
  label_texts,
  hrefs,
  Id = NULL,
  title = "A list of tabs",
  title_color = "#0275d8",
  bg_colors = "#337ab7",
  text_colors = "white",
  target_blank = FALSE,
  ...
)

Arguments

label_texts

individual tab labels

hrefs

individual tab links

Id

optional element ID

title

element title

title_color

title color

bg_colors

individual tab button background color, either 1 value to apply for all of them or specify for each of them in a vector

text_colors

individual tab button text color, either 1 value to apply for all of them or specify for each of them in a vector

target_blank

bool, whether to add target="_blank" to the link?

...

other arguments to be passed to the html element

Value

a Shiny component

Details

  1. label_texts, hrefs must be the same length

  2. If more than one value is provided for bg_colors or/and text_colors, the length of these 2 vectors must be the same as label_texts

  3. Use "" to occupy the space if you do not want a label contains a link, e.g hrefs = c("https://google.com/", "", "")

  4. If a label does not have a link, you cannot click it and there is no hovering effects.

Examples

if(interactive()){
    ui <- fluidPage(
        hrefTab(
            title = "Default",
            label_texts = c("Bar Plot", "PCA Plot", "Scatter Plot"),
            hrefs = c("https://google.com/", "", "")
        ),
        hrefTab(
            title = "Different background",
            label_texts = c("Bar Plot", "PCA Plot", "Scatter Plot"),
            hrefs = c("https://google.com/", "", ""),
            bg_colors = c("#eee", "orange", "green")
        ),
        hrefTab(
            title = "Different background and text colors",
            label_texts = c("Bar Plot", "Disabled", "Scatter Plot"),
            hrefs = c("https://google.com/", "", ""),
            bg_colors = c("green", "#eee", "orange"),
            text_colors = c("#caffc1", "black", "blue")
        )
    )

    server <- function(input, output, session) {

    }
    shinyApp(ui, server)
}