img_header {gtExtras}R Documentation

Add images as the column label for a table

Description

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

img_header.png

See Also

Other Utilities: add_text_img(), fa_icon_repeat(), fmt_pad_num(), fmt_pct_extra(), fmt_symbol_first(), generate_df(), gt_add_divider(), gt_badge(), gt_double_table(), gt_duplicate_column(), gt_fa_column(), gt_fa_rank_change(), gt_fa_rating(), gt_fa_repeats(), gt_highlight_cols(), gt_highlight_rows(), gt_img_border(), gt_img_circle(), gt_img_multi_rows(), gt_img_rows(), gt_index(), gt_merge_stack_color(), gt_merge_stack(), gt_two_column_layout(), gtsave_extra(), pad_fn(), tab_style_by_grp()


[Package gtExtras version 0.5.0 Index]