blob: c4917c52e0f541bbb9123b53c529c562129b160d [file] [log] [blame]
---
title: "htmlTable_styling Guide"
output:
html_document:
number_sections: true
vignette: >
%\VignetteIndexEntry{htmlTable Styling Guide}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
# Plain HTML
```{r}
library(knitr)
library(kableExtra)
dt <- mtcars[1:5, 1:2]
kable_input <- kable(dt, format = "html")
```
# Basic Bootstrap Table
```{r}
kable(dt, format = "html") %>%
htmlTable_styling()
```
# Boostrap Table Options
## Striped
```{r}
kable(dt, format = "html") %>%
htmlTable_styling(bootstrap_options = "striped")
```
## Striped + Hover
```{r}
kable(dt, format = "html") %>%
htmlTable_styling(c("striped", "hover"))
```
## Other bootstrap options
```{r}
kable(dt, format = "html") %>%
htmlTable_styling(c("striped", "bordered", "hover", "condensed", "responsive"))
```
# "Thin" Table and Floating options
```{r}
kable(dt, format = "html") %>%
htmlTable_styling(c("striped", "bordered", "condensed"), full_width = F)
```
```{r}
kable(dt, format = "html") %>%
htmlTable_styling(c("striped", "bordered", "condensed"), full_width = F, float = "left") %>%
htmlTable_add_header_above(c("", "Names" = 2))
```