hrefTab: Display a list of links in a row of buttons

Description Usage Arguments Details Value Examples

View source: R/spsUIcollections.R

Description

hrefTab creates a small section of link buttons

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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

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.

Value

a Shiny component

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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)
}

spsComps documentation built on Feb. 3, 2022, 1:07 a.m.