Skip to content

How to set a minimum number of items in a column #21

Open
@alexjackhughes

Description

Hello! Firstly, massive thanks for this library, its nice to keep everything in Tailwind, so appreciate you stepping up.


My issue is that on a certain screen size, I want there to be four columns that fill out so that one item goes into each column.

| 1 | 2 | 3 | 4 |

What appears to happen is the content fills out left-right, with the first column getting at least two items, and then populating the rest of the columns depending on how many items you have left.

| 1 | 3 | | |
| 2 | 4 | | |

Would it be possible to do this? It feels like I may be missing something obvious, any help that you can give would be appreciated 🙏

  <div className="flex flex-col md:flex-row h-full w-full">
    <div className="w-full col-count-1 xl:col-count-2 3xl:col-count-4 gap-x-5">
      {items.map((item, index) => (
        <div key={index} className="mb-5 inline-block w-full">
          {item}
        </div>
      ))}
    </div>
  </div>

Screenshot 2021-03-26 at 09 57 50

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions