Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

scroll_box

Put a HTML table into a scrollable box


Description

This function will put a HTML kable object in a fixed-height, fixed-width or both box and make it scrollable.

Usage

scroll_box(
  kable_input,
  height = NULL,
  width = NULL,
  box_css = "border: 1px solid #ddd; padding: 5px; ",
  extra_css = NULL,
  fixed_thead = TRUE
)

Arguments

kable_input

A HTML kable object

height

A character string indicating the height of the box, e.g. "50px"

width

A character string indicating the width of the box, e.g. "100px"

box_css

CSS text for the box

extra_css

Extra CSS styles

fixed_thead

HTML table option so table header row is fixed at top. Values can be either T/F or list(enabled = T/F, background = "anycolor").

Examples

## Not run: 
# Specify table size by pixels
kable(cbind(mtcars, mtcars), "html") %>%
    kable_styling() %>%
    scroll_box(width = "500px", height = "200px")

# Specify by percent
kable(cbind(mtcars, mtcars), "html") %>%
    kable_styling() %>%
    scroll_box(width = "100%", height = "200px")

## End(Not run)

kableExtra

Construct Complex Table with 'kable' and Pipe Syntax

v1.3.4
MIT + file LICENSE
Authors
Hao Zhu [aut, cre] (<https://orcid.org/0000-0002-3386-6076>), Thomas Travison [ctb], Timothy Tsai [ctb], Will Beasley [ctb], Yihui Xie [ctb], GuangChuang Yu [ctb], Stéphane Laurent [ctb], Rob Shepherd [ctb], Yoni Sidi [ctb], Brian Salzer [ctb], George Gui [ctb], Yeliang Fan [ctb], Duncan Murdoch [ctb], Bill Evans [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.