Hello,
I have been trying to get a table to render in a quarto revealjs presentation. I have most of it down, but the last bit is trying to get rounded edges to the table. after looking around I think I need to use opt_css() to get more specific details like this. I inspect the html and it does not seem to change the the appropriate css (.gt_table) and I have tried others (.gt_row). any advice on how to get rounded edges, or if I am doing the css wrong please let me know.
here is an image of the output: I was hoping each individual block/row is rounded like top of the right side of the slide.
Reproducible example
## [Background]{.slide_title}
```{css, echo = FALSE}
.response_rates {
background-color: #D1DFCE;
margin: 0px;
padding: 2px 2px 2px 2px;
border-radius: 15px;
}
:::::: {.columns style="font-size: 35%;"}
r if (params$locfilter == "g2" | params$locfilter == "g3") ":::::{.content-hidden}"
::::{.column width="70%"}
block of text
::::
r if (params$locfilter == "g2" | params$locfilter == "g3") ":::::"
r if (params$locfilter == "g2" | params$locfilter == "g1") ":::::{.content-hidden}"
::::{.column width="70%"}
block of text
::::
r if (params$locfilter == "g2" | params$locfilter == "g1") ":::::"
r if (params$locfilter == "g1" | params$locfilter == "g3")":::::{.content-hidden}"
::::{.column width="70%"}
block of text
::::
r if (params$locfilter == "g1" | params$locfilter == "g3") ":::::"
::::{.column width="30%"}
:::{.response_rates}
Program-wide Patient Survey Response Rate
:::
#| output: false
#| label: response_rate-creation
#| echo: false
rsps_dat <-
tibble(
image = c(fs::path_abs("images/pre_trans.jpg") %>% as.character(),
fs::path_abs("images/post_trans.jpg") %>% as.character(),
fs::path_abs("images/hcahps.jpg") %>% as.character()),
source = c("Pre-Transplant:", "Post-Transplant", "HCAHPS Survey"),
text = c(html(paste0("Response Rate: ",
# as.character(round(first(var_dat$resp_total_rsps_rt[var_dat$file_time=="Pre"]), 1)),
"%",
"<br>",
"Completion Rate: ",
# as.character(round(first(var_dat$resp_start_rsps_rt[var_dat$file_time=="Pre"]), 1)),
"%")),
html(paste0("Response Rate: ",
# as.character(round(first(var_dat$resp_total_rsps_rt[var_dat$file_time=="Post"]), 1)),
"%",
"<br>",
"Completion Rate: ",
# as.character(round(first(var_dat$resp_start_rsps_rt[var_dat$file_time=="Post"]), 1)),
"%")),
html(paste0("Average Response Rate*: ",
# as.character(round(unique(var_dat$hcahps_mean_pct_rsps_rt), 1)),
"%"))
)
) %>%
gt(id = "slide2_tbl") %>%
fmt_image(columns = image,
height = "3em") %>%
tab_style(
style = list(
cell_fill(color = "#D1DFCE")),
location = cells_body()
) %>%
tab_style(
style = cell_borders(
sides = c("top", "bottom"),
color = "white",
weight = px(20)
),
locations = cells_body(rows = everything())
) %>%
fmt_markdown(columns = text) %>%
cols_align(
align = c("left"),
columns = everything()
) %>%
cols_width(image ~ pct(20),
source ~ pct(30),
text ~ pct(50),
) %>%
tab_footnote(
footnote = glue::glue('* {as.character(format(max(var_dat$hcahps_pll_dt), "%m/%d/%Y"))} is the last published HCAHPS benchmark, it includes data from {as.character(format(max(var_dat$hcahps_start_date), "%m/%d/%Y"))} to {as.character(format(max(var_dat$hcahps_end_date), "%m/%d/%Y"))}'),
locations = NULL,
placement = "left"
) %>%
tab_options(column_labels.hidden = TRUE,
footnotes.font.size = pct(60),
) %>%
opt_css(.,
css = "
#slide2_tbl .gt_table {
margin: 0px;
background: white;
padding: 0px 0px 0px 0px;
border-radius: 150px;
}
")
:::{}
r rsps_dat
:::
::::
::::::
## expected outcome.
the goal is to have all for green bands have rounded edges.....
## Session info
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.9.4 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2 readr_2.1.5 tidyr_1.3.1
[8] tibble_3.2.1 ggplot2_3.5.1 tidyverse_2.0.0 patchwork_1.3.0 shadowtext_0.1.4 gt_0.11.1 RColorBrewer_1.1-3
[15] psych_2.4.6.26 dbplyr_2.5.0 magrittr_2.0.3 readxl_1.4.3 pacman_0.5.1
loaded via a namespace (and not attached):
[1] gtable_0.3.6 xfun_0.49 lattice_0.22-5 tzdb_0.4.0 vctrs_0.6.5 odbc_1.6.0 tools_4.3.3
[8] generics_0.1.3 parallel_4.3.3 fansi_1.0.6 blob_1.2.4 pkgconfig_2.0.3 lifecycle_1.0.4 compiler_4.3.3
[15] farver_2.1.2 munsell_0.5.1 mnormt_2.1.1 htmltools_0.5.8.1 sass_0.4.9 yaml_2.3.10 pillar_1.9.0
[22] crayon_1.5.3 rsconnect_1.3.4 nlme_3.1-164 commonmark_1.9.2 tidyselect_1.2.1 digest_0.6.37 stringi_1.8.4
[29] fastmap_1.2.0 grid_4.3.3 colorspace_2.1-1 cli_3.6.3 logger_0.4.0 base64enc_0.1-3 utf8_1.2.4
[36] withr_3.0.2 scales_1.3.0 bit64_4.5.2 timechange_0.3.0 bit_4.5.0.1 cellranger_1.1.0 png_0.1-8
[43] hms_1.1.3 evaluate_1.0.1 knitr_1.49 markdown_1.13 rlang_1.1.4 Rcpp_1.0.13-1 glue_1.8.0
[50] DBI_1.2.3 xml2_1.3.6 rstudioapi_0.17.1 R6_2.5.1 fs_1.6.5