rstudio / bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
https://rstudio.github.io/bslib/
Other
443 stars 49 forks source link

feat(card_image): Improve `card_image()` API and usage #1076

Open gadenbuie opened 3 weeks ago

gadenbuie commented 3 weeks ago

This PR improves the card_image() API and fixes a few minor rough edges, including fixing #1071.

Example app ```r library(shiny) # library(bslib) pkgload::load_all() card_img <- card_image( file = "https://picsum.photos/seed/posit/600/300" ) ui <- page_fillable( layout_column_wrap( width = 300, # advanced usage with a card image overlay # see: https://getbootstrap.com/docs/5.3/components/card/#image-overlays card( class = "text-light", card_image( file = "https://picsum.photos/seed/posit/600/900", # fill = TRUE, border_radius = "all" ), card_body( class = "card-img-overlay", lorem::ipsum(2) ) ), # Typical usage: card top cap card( card_img, lorem::ipsum(1), ), # Typical usage: card bottom cap card( lorem::ipsum(1), card_img, ), # Typical usage: images for top/bottom cap, plus one in middle card( fill = FALSE, card_img, lorem::ipsum(1, 2), card_img, lorem::ipsum(1, 2), card_img ) ) ) server <- function(input, output, session) { } shinyApp(ui, server) ```

image