blob: d5b1faaaf7312362b6fe7bdedcbbafd7bcf9ba5e [file] [log] [blame]
---
title: "kable_styling - HTML"
output: html_document
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(dt, format = "html")
```
# Basic Bootstrap Table
```{r}
kable(dt, format = "html") %>%
kable_styling()
```
# Boostrap Table Options
## Striped
```{r}
kable(dt, format = "html") %>%
kable_styling(bootstrap_options = "striped")
```
## Striped + Hover
```{r}
kable(dt, format = "html") %>%
kable_styling(c("striped", "hover"))
```
## Other bootstrap options
```{r}
kable(dt, format = "html") %>%
kable_styling(c("striped", "bordered", "hover", "condensed", "responsive"))
```
# "Thin" Table and Floating options
```{r}
kable(dt, format = "html") %>%
kable_styling(c("striped", "bordered", "condensed"), full_width = F)
```
```{r}
kable(dt, format = "html") %>%
kable_styling(c("striped", "bordered", "condensed"), full_width = F,
float = "left", font_size = 10) %>%
add_header_above(c(" ", "Names" = 2)) %>%
add_header_above(c(" " = 2, "Names")) %>%
add_header_above(c("Names[note]" = 3)) %>%
add_footnote("note")
```