-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
v4/v5: Row columns for responsive card decks and more #29073
Conversation
And here's how it could work with some Sass mixins: https://www.sassmeister.com/gist/1a567b85b0c7c5a837e9b65be6220688. |
This is ready for review @twbs/css-review. |
I don't see the benefit of this. We can just use the grid for this. |
This would be really helpful when you're pulling a dynamic list and unable to change the grid markup each time. Having it on the parent class would make it "set it and forget it". |
Could we have these classes responsive with breakpoints that way we can have 1 column stacked on mobile and multiple columns on desktop? row-cols-1 row-cols-md-3 |
Yup, that's the intent of the changes here: https://github.com/twbs/bootstrap/pull/29073/files#diff-f6ca44772c5cdca97cf5be7357416fb8. |
Trying to find a new way to do responsive card decks while not locking ourselves into the cards themselves. My thinking here is we can easily control the column (.col) width by the parent, but I don't know how many we need (have 0-5 now) across each breakpoint. This works for cards so far, and I think could get us equal height, too.
Rebased |
Ok, I think this can come in handy in some situations, but the current implementation needs some fine tuning:
|
Made an alternative implementation draft of this in #29274 which solves these issues |
@XhmikosR I want to comment, so please leave this. (but sorry, I don't have time today...) |
The difference between this PR and #29274 is the need for I support the @mdo proposal which requires
If this traditional rule changes, it will confuse the many user. This PR can not overriding the default width because of the CSS priority, but this can be fixed by changing the definition order. I created #29317 for clarify the diff. |
Is this ready from all of you @twbs/css-review? |
It is better to add a responsive examples on the grid page :) |
@ysds can you do it please? |
done! |
@mdo please have a final look and hit rebase and merge if it LGTY, thanks! |
This needs to be backported manually in my v4-dev-xmr branch. I'll have another try again later, but it conflicts a lot. Also note that we need to make sure we don't use Hugo-related stuff in v4, like |
Overview
Trying to find a new way to do responsive card decks while not locking ourselves into more card classes. My thinking here is we can easily control the column (
.col
) width by the parent with responsive.row-cols-*
classes, but I don't know how many we need (have 0-5 now)./cc @twbs/css-review
How it works
We can add a default number of columns to support (thinking a max of
6
). You can override this if you like, but otherwise we'll loop over it and generate the responsive classes.Here's a simplified example with out the responsive infixes. See it in action via Sassmeister.
Screenshots
Some screenshots to show how it's shaping up for grid columns and cards.
Preview: https://deploy-preview-29073--twbs-bootstrap.netlify.com/docs/4.3/components/card/#grid-cards
https://deploy-preview-29073--twbs-bootstrap.netlify.com/docs/4.3/layout/grid/#row-columns