I am trying to mimic hoverablity effect like tables produced with kableExtra
which creates a very appealing effect and was wondering if anyone has an idea how this may be doable with flextable
.
Here's an example Rmd to get a glimpse of what I mean. I'd like the flextable to allow the hover effect that is visible in the kable.
---
output: bookdown::html_document2
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
```{r mykable}
iris |>
head() |>
kableExtra::kbl(caption = "a caption") |>
kableExtra::kable_styling(bootstrap_options = "hover")
```
```{r myflextable}
iris |>
head() |>
flextable::flextable() |>
flextable::set_caption("a caption")
```
Use flextable::set_table_properties
to add custom CSS.
flextable::set_table_properties(opts_html = list(
extra_css = "
tbody tr:hover {
background-color: #f5f5f5 !important;
transition: background-color 0.3s ease;
}
"
))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With