Skip to contents

Add images as the column label for a table

Usage

img_header(
  label,
  img_url,
  height = 60,
  font_size = 12,
  palette = c("black", "black")
)

Arguments

label

A string indicating the label of the column.

img_url

A string for the image url.

height

A number indicating the height of the image in pixels.

font_size

The font size of the label in pixels.

palette

A vector of two colors, indictating the bottom border color and the text color.

Value

HTML string

Examples

library(gt)
dplyr::tibble(
  x = 1:5, y = 6:10
) %>%
  gt() %>%
  cols_label(
    x = img_header(
      "Luka Doncic",
      "https://secure.espn.com/combiner/i?img=/i/headshots/nba/players/full/3945274.png",
      height = 60,
      font_size = 14
    )
  )

Figures