Alignement of a column label works in gt, but when adding opt_interactive(), the alignement is ignored.
For example:
library(gt)
# dataframe
df <- data.frame(
column1 = c("test", "tekst", "nog een tekst")
, column2 = c(100000078, 45, 783)
, column3 = rep("tekst", 3)
)
# without align
no_align <- df |> gt()
no_align
# with align
with_align <- no_align |>
tab_style(
style = cell_text(align = "left"),
locations = cells_column_labels(columns = column2)
)
with_align
# with align and interactivity
with_align_interactive <- with_align |>
opt_interactive(
active = TRUE
, use_pagination = FALSE
, use_pagination_info = FALSE
, use_sorting = FALSE
, use_search = TRUE
, use_highlight = TRUE
, use_text_wrapping = FALSE)
with_align_interactive
Is it possible to fix this?
Session info:
R version 4.4.3 (2025-02-28 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)
Matrix products: default
locale:
[1] LC_COLLATE=Dutch_Netherlands.utf8 LC_CTYPE=Dutch_Netherlands.utf8 LC_MONETARY=Dutch_Netherlands.utf8 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.utf8
time zone: Europe/Amsterdam
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gt_1.3.0
loaded via a namespace (and not attached):
[1] digest_0.6.37 R6_2.6.1 fastmap_1.2.0 tidyselect_1.2.1 magrittr_2.0.3 reactR_0.6.1 glue_1.8.0 tibble_3.2.1 htmltools_0.5.8.1
[10] pkgconfig_2.0.3 dplyr_1.1.4 generics_0.1.3 lifecycle_1.0.4 reactable_0.4.4 xml2_1.3.8 cli_3.6.4 sass_0.4.10 vctrs_0.6.5
[19] withr_3.0.2 compiler_4.4.3 rstudioapi_0.17.1 tools_4.4.3 pillar_1.10.2 yaml_2.3.10 jsonlite_2.0.0 htmlwidgets_1.6.4 rlang_1.1.6
[28] fs_1.6.6 crosstalk_1.2.1
'''
Alignement of a column label works in gt, but when adding opt_interactive(), the alignement is ignored.
For example:
Is it possible to fix this?
Session info: