blob: 5287889e2b9fc2cad4b0c02503a706f352fa917f [file] [log] [blame]
Hao Zhu94956582017-02-21 18:18:29 -05001---
2title: "htmlTable_styling Guide"
3output:
4 html_document:
5 number_sections: true
6vignette: >
7 %\VignetteIndexEntry{htmlTable Styling Guide}
8 %\VignetteEngine{knitr::rmarkdown}
9 %\VignetteEncoding{UTF-8}
10---
11
12# Basic HTML
13```{r}
14library(knitr)
15library(kableExtra)
16dt <- mtcars[1:5, 1:2]
17
18kable(dt, format = "html")
19```
20
21# Basic Bootstrap Table
22```{r}
23kable(dt, format = "html", table.attr = htmlTable_styling())
24```
25
26# Boostrap Table Options
27## Striped
28```{r}
29kable(dt, format = "html", table.attr = htmlTable_styling(bootstrap_options = "striped"))
30```
31
32## Striped + Hover
33```{r}
34kable(dt, format = "html", table.attr = htmlTable_styling(c("striped", "hover")))
35```
36
37## Other bootstrap options
38```{r}
39kable(dt, format = "html",
40 table.attr = htmlTable_styling(c("striped", "bordered", "hover", "condensed", "responsive")))
41```
42
43# "Thin" Table and Floating options
44```{r}
45kable(dt, format = "html",
46 table.attr = htmlTable_styling(
47 c("striped", "bordered", "condensed"),
48 full_width = F,
49 float = "center"
50 ))
51```
52
53
54