x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<div class="flex flex-col gap-6"> <div> <p class="text-sm text-gray-11 px-1 mb-2">Default (<code>auto-fit</code>) — last items stretch to fill the row</p> <div class="midwest-grid" style="--grid-width: 180px; --grid-gap: 1rem"> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 1</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 2</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 3</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 4</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 5</p> </section> </div> </article> </div> </div> <div> <p class="text-sm text-gray-11 px-1 mb-2">With <code>fit: true</code> (<code>auto-fill</code>) — empty columns are preserved, items stay at minimum width</p> <div class="midwest-grid fit" style="--grid-width: 180px; --grid-gap: 1rem"> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 1</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 2</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 3</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 4</p> </section> </div> </article> <article data-controller="midwest-card" class="midwest-card"> <div class="wrap"> <section> <p class="font-bold text-center">Item 5</p> </section> </div> </article> </div> </div></div>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div class="flex flex-col gap-6"> <div> <p class="text-sm text-gray-11 px-1 mb-2">Default (<code>auto-fit</code>) — last items stretch to fill the row</p> <%= midwest_grid(width: 180, gap: 1) do %> <% 5.times do |i| %> <%= midwest_card do %> <p class="font-bold text-center">Item <%= i + 1 %></p> <% end %> <% end %> <% end %> </div> <div> <p class="text-sm text-gray-11 px-1 mb-2">With <code>fit: true</code> (<code>auto-fill</code>) — empty columns are preserved, items stay at minimum width</p> <%= midwest_grid(width: 180, gap: 1, fit: true) do %> <% 5.times do |i| %> <%= midwest_card do %> <p class="font-bold text-center">Item <%= i + 1 %></p> <% end %> <% end %> <% end %> </div></div>Fit
By default the grid uses auto-fit, which stretches the last row of items
to fill available space. Pass fit: true to switch to auto-fill, which
preserves empty column tracks so items stay at their minimum width.
No params configured.
No assets to display.
Add a .js or .css file alongside the component to see it here.
Figma embed for Grid/fit
Annotate a preview to embed its Figma design here:
@figma "https://figma.com/..."