Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(layout_column_wrap): Allow items to be smaller than min width #851

Merged
merged 5 commits into from
Oct 19, 2023

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Oct 19, 2023

Non-breaking change from #799

When width is a CSS unit (i.e. not a fractional unit between 0 and 1) and fixed_width = FALSE, this PR changes the value for grid-template-columns from

repeat(auto-fit, minmax({width}, 1fr))

to

repeat(auto-fit, minmax(min({width}, 100%), 1fr))

The result is that the items in a column-wrapped layout no longer overflow their container if the container width is less than the specified width (unless fixed_width = TRUE, of course).

Example

# Open me on a medium sized screen (i.e., between about 800-500px) 
# and notice how the cards "bleed outside" of their containing column

my_card <- card(lorem::ipsum(2), max_height = 100)

page_fixed(
  layout_column_wrap(
    width = "800px", 
    class = "border border-danger",
    !!!replicate(3, my_card, simplify = F)
  )
)
Before After
image image

@gadenbuie gadenbuie self-assigned this Oct 19, 2023
@gadenbuie gadenbuie requested a review from cpsievert October 19, 2023 15:20
@gadenbuie gadenbuie marked this pull request as ready for review October 19, 2023 15:20
@gadenbuie gadenbuie merged commit a5bfc06 into main Oct 19, 2023
@gadenbuie gadenbuie deleted the layout-column-wrap/fix-overflow branch October 19, 2023 17:53
schloerke added a commit to posit-dev/py-shiny that referenced this pull request Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants