
Render Team Logos, Wordmarks and Headshots in 'reactable' Tables
Source:R/reactable_sdv.R
reactable_sdv_images.RdCell renderers for reactable::colDef() that translate team
abbreviations (or player IDs) into <img> tags. Values that cannot be
resolved are returned unchanged so the original text is shown.
Usage
reactable_sdv_logos(
sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb"),
variant = c("primary", "dark", "light", "alt", "classic", "helmet"),
height = 30,
default_img = NULL
)
reactable_sdv_wordmarks(
sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb"),
variant = c("primary", "dark", "light", "alt", "classic"),
height = 30,
default_img = NULL
)
reactable_sdv_headshots(
sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb"),
height = 40,
default_img = NULL,
id_type = NULL
)Arguments
- sport
Character string identifying the sport. One of
supported_sports().- variant
Character. Logo variant:
"primary","dark","light","alt","classic", or"helmet"(NFL only). Falls back to the primary image when the requested variant is not available for a team.- height
Numeric. Image height in pixels.
- default_img
Character. Fallback image URL used when the value cannot be resolved. If
NULL(the default) the raw value is shown instead.- id_type
Which ID system the player IDs hold:
NULL(the default; GSIS IDs for the NFL, ESPN athlete IDs otherwise),"espn"or"league"(NBA / WNBA StatsPERSON_ID, MLBAM, NHL API, GSIS). Seegeom_sdv_headshots().
Value
A function with signature function(value, index) suitable for the
cell argument of reactable::colDef().