Grid Repeat Auto

GridRepeatAuto functions like SimpleGrid, except you decide the width of each grid item. Super useful for creating nice and controlled layouts.


Great for width-sensitive content

GridRepeatAuto is perfect when you need you need to size every grid item manually.

One great use-case is a Content + Sidebar layout since both elements need to be sized accordingly.

index.html
<div class="GridRepeatAuto [--cols:2]">
<div class="w-[15rem]"> ... </div>
<div class="w-[8rem]"> ... </div>
</div>

Psst: Adding width to Grid Repeat Auto items can be far easier than calculating the width of the Simple Grid container! Less headaches!

Automatically centered

This is the behaviour you would use most of the time so we built it in for you. You’re welcome!

index.html
<div class="SimpleGrid [--cols:3]">
<div class="w-[5rem]">...</div>
<div class="w-[10rem]">...</div>
<div class="w-[5rem]">...</div>
</div>

Controlled Responsive Behaviour

GridRepeatAuto items will maintain their width whenever possible so your content is controlled and doesn’t get too big.

They only shrink when there’s insufficient space, which is what you’ll want anyway.

index.html
<div class="GridRepeatAuto md:[--cols:2] lg:[--cols:3]">
<div class="w-[6rem]">...</div>
<div class="w-[6rem]">...</div>
<div class="w-[6rem]">...</div>
</div>
Resize to see this work!

No minmax nonsense

GridRepeatAuto is also wrapped with minmax so you never have to worry about overflowing grid items.

Resize to see this work!