creates a table in Shiny which the cells are hyper reference (links) buttons. This function is similar to hrefTab, but that function only creates a single row of link buttons, and this function creates a table of rows.

The table has two columns, the first column is row names, second column is different link buttons.

hrefTable(
  item_titles,
  item_labels,
  item_hrefs,
  item_title_colors = "#0275d8",
  item_bg_colors = "#337ab7",
  item_text_colors = "white",
  Id = NULL,
  first_col_name = "Category",
  second_col_name = "Options",
  title = "A Table buttons with links",
  title_color = "#0275d8",
  target_blank = FALSE,
  ...
)

Arguments

item_titles

vector of strings, a vector of titles for table row names

item_labels

list, a list of character vectors to specify button labels in each table row, one vector per row

item_hrefs

list, a list of character vectors to specify button hrefs links in each table row, one vector per row

item_title_colors

a single character value or a character vector to specify button title text colors of each row name

item_bg_colors

a single character value or a list, a list of character vectors to specify button background colors in each table row, one vector per row

item_text_colors

a single character value or a list, a list of character vectors to specify button text colors in each table row, one vector per row

Id

optional ID

first_col_name

first column name

second_col_name

second column name

title

title of this table

title_color

table title color

target_blank

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

...

other HTML param you want to pass to the table

Value

HTML elements

Details

  1. item_titles, item_labels, item_hrefs must have the same length. Each vector in item_labels, item_hrefs must also have the same length. For example, if we want to make a table of two rows, the first row has 1 cell and the second row has 2 cells:

 hrefTable(
     item_titles = c("row 1", "row 2"),
     item_labels = list(c("cell 1"), c("cell 1", "cell 2")),
     item_hrefs = list(c("link1"), c("link1", "link2")
 )

  1. If item_title_colors, item_text_colors are given more than one value, the list must have the same length as item_titles, and length of each vector in the list must match the vector in item_labels in the same order.

  2. If item_title_colors is given more than one value, the vector must have the same length as item_titles.

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

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

Examples

if(interactive()){
    ui <- fluidPage(
        hrefTable(
            title = "default",
            item_titles = c("workflow 1", "unclickable"),
            item_labels = list(c("tab 1"), c("tab 3", "tab 4")),
            item_hrefs = list(c("https://www.google.com/"), c("", ""))
        ),
        hrefTable(
            title = "Change button color and text color",
            item_titles = c("workflow 1", "No links"),
            item_labels = list(c("tab 1"), c("tab 3", "tab 4")),
            item_hrefs = list(c("https://www.google.com/"), c("", "")),
            item_bg_colors =  list(c("blue"), c("red", "orange")),
            item_text_colors =  list(c("black"), c("yellow", "green"))
        ),
        hrefTable(
            title = "Change row name colors and width",
            item_titles = c("Green", "Red", "Orange"),
            item_labels = list(c("tab 1"), c("tab 3", "tab 4"), c("tab 5", "tab 6", "tab 7")),
            item_hrefs = list(
                c("https://www.google.com/"),
                c("", ""),
                c("https://www.google.com/", "https://www.google.com/", "")
            ),
            item_title_colors = c("green", "red", "orange"),
            style = "width: 50%"
        )

    )

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

    }

    shinyApp(ui, server)
}