Grid inside List should support flex
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
https://jsfiddle.net/chunlea/zxsb1kpd/
Steps to reproduce
Created a List
with Card
, enable grid
, and the layout is mass.

What is expected?
Like Row
Component, with flex
, the layout should look like

What is actually happening?
I looked at the source code and found that https://github.com/ant-design/ant-design/blob/master/components/list/index.tsx#L232 we only pass grid.gutter
to Row
and use Context to pass other options to List.Item
col
Maybe we should support all RowProps
fields here https://github.com/ant-design/ant-design/blob/master/components/grid/row.tsx#L29-L35 in grid
of List
Component?
Environment | Info |
---|---|
antd | 3.12.3 |
React | 16.7.0 |
System | macOS |
Browser | Chrome 71 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Relationship of grid layout to other layout methods - CSS
In this guide, I will explain how a grid fits together with other ... The basic difference between CSS Grid Layout and CSS...
Read more >How to combine Flexbox and CSS grids for efficient layouts
Starting from the outside and working in, adding display: flex; to the container is the first step in any Flexbox layout. The flex-direction...
Read more >Grid for layout, Flexbox for components - Ahmad Shadeed
Flexbox is laying out an inline list of elements, while CSS grid made them a grid of columns and rows. Flexbox is aligning...
Read more >CSS Grid inside Flexbox not working as expected only on ...
The flexbox ( .container ) fills the entire viewport. · The height of the header is variable. · The four cells in the...
Read more >A Complete Guide to CSS Grid
This could happen if all of your grid items are sized with non-flexible units like px . In this case you can set...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s simple workaround
export const FlexList = ({ dataSource, renderItem, gutter}) => (<Row gutter={gutter} type='flex'>{ dataSource.map(entity => renderItem(entity)) }</Row>);
As a workaround, you can wrap all items (
children
), with a<div className="ant-row-flex"