rstudio / bslib

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

Small `value_box()` doesn't align showcase properly #994

Open cpsievert opened 4 months ago

cpsievert commented 4 months ago

When value boxes get small, we change from a "left center" layout to a "top right" layout. Turns out that, the right portion of that just happens to work when you put icons (which have margin-left: auto) in the showcase, but if you put something else, like text, the showcase is centered:

library(bslib)

page_fixed(
  value_box(
    "Title", "value", showcase = span("showcase"),
    style = "width: 275px; resize: both"
  )
)
Screenshot 2024-02-26 at 6 06 31 PM
gadenbuie commented 4 months ago

When value boxes get small, we change from a "left center" layout to a "top right" layout.

This isn't quite what's happening. Each of the layouts has its own "small width" design.

image

I could be talked into having the "left center" showcase be left-aligned in small value box widths, but there is a consistency in "left center", "top right", "bottom".