ijlyttle / bsplus

Shiny and R Markdown addons to Bootstrap 3
http://ijlyttle.github.io/bsplus/
Other
147 stars 23 forks source link

Compatability with rstudio/bslib bootstrap version 4 or 5? #102

Open rbcavanaugh opened 2 years ago

rbcavanaugh commented 2 years ago

Hi -

I'm hoping to use bs_accordion() in a shiny app I'm developing but I'm inclined to use bs4 or bs5. Is there a way to use bs_accordion() with bs4 or bs5? Note that changing version to version = "3" results in the accordion rendering properly.

Thank you!!

Reprex:

library(bslib)
library(shiny)
library(bsplus)
library(htmltools)

shinyApp(
  ui = fluidPage(theme = bslib::bs_theme(version = "4"),
    bsplus::bs_accordion(id = "beatles") %>%
      bsplus::bs_set_opts(panel_type = "success", use_heading_link = TRUE) %>%
      bsplus::bs_append(title = "John Lennon", content = "Rhythm guitar, vocals") %>%
      bsplus::bs_append(title = "Paul McCartney", content = "Bass guitar, vocals") %>%
      bsplus::bs_append(title = "George Harrison", content = "Lead guitar, vocals") %>%
      bsplus::bs_set_opts(panel_type = "info") %>%
      bsplus::bs_append(title = "Ringo Starr", content = "Drums, vocals") 
  ),
  server = function(input, output, session) {

  }
)
> sessioninfo::session_info()
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.0.3 (2020-10-10)
 os       macOS  11.6                 
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2021-11-25                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version     date       lib source                       
 bslib       * 0.3.1       2021-10-06 [1] CRAN (R 4.0.2)               
 bsplus      * 0.1.3       2021-10-05 [1] CRAN (R 4.0.2)               
 cachem        1.0.6       2021-08-19 [1] CRAN (R 4.0.3)               
 callr         3.7.0       2021-04-20 [1] CRAN (R 4.0.2)               
 cli           3.0.1.9000  2021-08-09 [1] Github (r-lib/cli@457ad44)   
 crayon        1.4.1       2021-02-08 [1] CRAN (R 4.0.3)               
 desc          1.3.0       2021-03-05 [1] CRAN (R 4.0.2)               
 devtools    * 2.4.2       2021-06-07 [1] CRAN (R 4.0.2)               
 digest        0.6.28      2021-09-23 [1] CRAN (R 4.0.2)               
 ellipsis      0.3.2       2021-04-29 [1] CRAN (R 4.0.2)               
 fastmap       1.1.0       2021-01-25 [1] CRAN (R 4.0.2)               
 fs            1.5.0       2020-07-31 [1] CRAN (R 4.0.2)               
 generics      0.1.0       2020-10-31 [1] CRAN (R 4.0.2)               
 glue          1.4.2       2020-08-27 [1] CRAN (R 4.0.2)               
 htmltools   * 0.5.2       2021-08-25 [1] CRAN (R 4.0.2)               
 httpuv        1.6.3       2021-09-09 [1] CRAN (R 4.0.3)               
 jquerylib     0.1.4       2021-04-26 [1] CRAN (R 4.0.2)               
 jsonlite      1.7.2       2020-12-09 [1] CRAN (R 4.0.2)               
 later         1.3.0       2021-08-18 [1] CRAN (R 4.0.3)               
 lifecycle     1.0.1       2021-09-24 [1] CRAN (R 4.0.3)               
 lubridate     1.7.10      2021-02-26 [1] CRAN (R 4.0.2)               
 magrittr      2.0.1       2020-11-17 [1] CRAN (R 4.0.2)               
 memoise       2.0.0       2021-01-26 [1] CRAN (R 4.0.2)               
 mime          0.12        2021-09-28 [1] CRAN (R 4.0.3)               
 pkgbuild      1.2.0       2020-12-15 [1] CRAN (R 4.0.2)               
 pkgload       1.2.3       2021-10-13 [1] CRAN (R 4.0.2)               
 prettyunits   1.1.1       2020-01-24 [1] CRAN (R 4.0.2)               
 processx      3.5.2       2021-04-30 [1] CRAN (R 4.0.2)               
 promises      1.2.0.1     2021-02-11 [1] CRAN (R 4.0.3)               
 ps            1.6.0       2021-02-28 [1] CRAN (R 4.0.2)               
 purrr         0.3.4       2020-04-17 [1] CRAN (R 4.0.2)               
 R6            2.5.1       2021-08-19 [1] CRAN (R 4.0.2)               
 Rcpp          1.0.7       2021-07-07 [1] CRAN (R 4.0.2)               
 remotes       2.4.0       2021-06-02 [1] CRAN (R 4.0.2)               
 rlang         0.99.0.9000 2021-10-21 [1] Github (r-lib/rlang@9200c00) 
 rprojroot     2.0.2       2020-11-15 [1] CRAN (R 4.0.2)               
 sass          0.4.0.9000  2021-06-01 [1] Github (rstudio/sass@f148415)
 sessioninfo   1.1.1       2018-11-05 [1] CRAN (R 4.0.2)               
 shiny       * 1.7.1       2021-10-02 [1] CRAN (R 4.0.2)               
 testthat      3.1.0       2021-10-04 [1] CRAN (R 4.0.2)               
 usethis     * 2.0.1       2021-02-10 [1] CRAN (R 4.0.2)               
 withr         2.4.2       2021-04-18 [1] CRAN (R 4.0.2)               
 xtable        1.8-4       2019-04-21 [1] CRAN (R 4.0.2)               

[1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
daranzolin commented 1 year ago

I have the same use case and need. @rbcavanaugh did you happen upon a solution?

rbcavanaugh commented 1 year ago

@daranzolin Yup! I implemented the code here: https://unleash-shiny.rinterface.com/beautify-with-bootstraplib.html?q=accordion#bslib-bootstrap-accordion

daranzolin commented 1 year ago

@rbcavanaugh that works, thanks so much!