Bento Grid
A modular grid of tiles in different sizes; switch between three arrangements and watch tiles glide into place.
AI prompt
Bento grid layout, 4 columns by 3 rows of rounded tiles (corner radius 20px, 12px gaps) on a warm off-white background, one large hero tile spanning 2 by 2, two medium tiles spanning 2 by 1 and four small square tiles, each tile with a single clear element: a large number, a small chart, an icon, a short heading, balanced negative space inside every tile, consistent soft grey and white palette with one accent colour, subtle 1px borders, no shadows, modern product page composition, flat design, high clarity, aligned edges. Variation: dark mode bento with #111 tiles; colourful bento with one tile per brand colour. Negative: uneven gaps, overlapping tiles, clutter, tiny text, random sizes, perspective distortion.About this pattern
Definition
A bento layout divides the canvas into rounded tiles of different sizes, like the compartments of a bento box. Each tile holds one idea, and the size shows its importance.
When to use it
- Presents several features or stats on one screen with clear hierarchy, common in product pages and dashboards.
- Keep gaps equal (12 to 16px) and corner radii consistent so the structure reads as one system.
- One large hero tile, a few medium ones and small supporting tiles works best.
What the controls do
- Three arrangement buttons (Feature, Balanced, Stack); tiles move with a FLIP animation.
Motion & timing
- Tiles glide 420ms cubic-bezier(.2,.7,.2,1) from their old to their new position.
- Reduced motion: tiles jump to the new layout.
Tips & variations
- On narrow screens the grid collapses to two columns and the large tile spans both.
- Tiles keep their reading order in the DOM, independent of the visual arrangement.
Code of this live preview
<div class="bx"><div class="bento" id="bento"><div class="t" data-n="1">Hero</div><div class="t" data-n="2">24k</div><div class="t" data-n="3">Chart</div><div class="t" data-n="4">Icon</div><div class="t" data-n="5">Tip</div><div class="t" data-n="6">+12%</div></div>
<div class="pre" id="pre" role="group" aria-label="Arrangement"><button data-l="0" aria-pressed="true">Feature</button><button data-l="1" aria-pressed="false">Balanced</button><button data-l="2" aria-pressed="false">Stack</button></div></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
.bx{width:min(320px,100%)}
.bento{display:grid;grid-template-columns:repeat(4,1fr);grid-auto-rows:44px;gap:8px}
.t{display:grid;place-items:center;border:1px solid var(--line);border-radius:14px;background:var(--surface);font-size:12px;font-weight:600}
.t[data-n="1"]{background:#171717;color:#fff}
.t[data-n="3"]{background:#e8e8e4}
.l0 .t[data-n="1"]{grid-column:span 2;grid-row:span 2}.l0 .t[data-n="2"]{grid-column:span 2}.l0 .t[data-n="3"]{grid-column:span 2}
.l1 .t[data-n="1"]{grid-column:span 2}.l1 .t[data-n="3"]{grid-column:span 2;grid-row:span 2}.l1 .t[data-n="5"]{grid-column:span 2}
.l2 .t[data-n="1"]{grid-column:span 4}.l2 .t[data-n="2"]{grid-column:span 2}.l2 .t[data-n="3"]{grid-column:span 2}.l2 .t[data-n="5"]{grid-column:span 4}
.pre{display:flex;gap:6px;margin-top:10px}
.pre button{flex:1;height:30px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font:inherit;font-size:12px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.pre button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}const b=document.getElementById('bento'),ts=[...b.children],reduce=matchMedia('(prefers-reduced-motion: reduce)').matches,bs=[...document.querySelectorAll('#pre button')];
b.className='bento l0';
function set(l){const f=new Map(ts.map(t=>[t,t.getBoundingClientRect()]));b.className='bento l'+l;bs.forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.l==l)));
if(reduce)return;ts.forEach(t=>{const o=f.get(t),n=t.getBoundingClientRect();t.animate([{transform:'translate('+(o.left-n.left)+'px,'+(o.top-n.top)+'px) scale('+(o.width/n.width)+','+(o.height/n.height)+')'},{transform:'none'}],{duration:420,easing:'cubic-bezier(.2,.7,.2,1)'});});}
bs.forEach(x=>x.addEventListener('click',()=>set(x.dataset.l)));One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Bento Grid — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.bx{width:min(320px,100%)}
.bento{display:grid;grid-template-columns:repeat(4,1fr);grid-auto-rows:44px;gap:8px}
.t{display:grid;place-items:center;border:1px solid var(--line);border-radius:14px;background:var(--surface);font-size:12px;font-weight:600}
.t[data-n="1"]{background:#171717;color:#fff}
.t[data-n="3"]{background:#e8e8e4}
.l0 .t[data-n="1"]{grid-column:span 2;grid-row:span 2}.l0 .t[data-n="2"]{grid-column:span 2}.l0 .t[data-n="3"]{grid-column:span 2}
.l1 .t[data-n="1"]{grid-column:span 2}.l1 .t[data-n="3"]{grid-column:span 2;grid-row:span 2}.l1 .t[data-n="5"]{grid-column:span 2}
.l2 .t[data-n="1"]{grid-column:span 4}.l2 .t[data-n="2"]{grid-column:span 2}.l2 .t[data-n="3"]{grid-column:span 2}.l2 .t[data-n="5"]{grid-column:span 4}
.pre{display:flex;gap:6px;margin-top:10px}
.pre button{flex:1;height:30px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font:inherit;font-size:12px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.pre button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
</style></head>
<body><div class="stage">
<div class="bx"><div class="bento" id="bento"><div class="t" data-n="1">Hero</div><div class="t" data-n="2">24k</div><div class="t" data-n="3">Chart</div><div class="t" data-n="4">Icon</div><div class="t" data-n="5">Tip</div><div class="t" data-n="6">+12%</div></div>
<div class="pre" id="pre" role="group" aria-label="Arrangement"><button data-l="0" aria-pressed="true">Feature</button><button data-l="1" aria-pressed="false">Balanced</button><button data-l="2" aria-pressed="false">Stack</button></div></div>
</div>
<script>
const b=document.getElementById('bento'),ts=[...b.children],reduce=matchMedia('(prefers-reduced-motion: reduce)').matches,bs=[...document.querySelectorAll('#pre button')];
b.className='bento l0';
function set(l){const f=new Map(ts.map(t=>[t,t.getBoundingClientRect()]));b.className='bento l'+l;bs.forEach(x=>x.setAttribute('aria-pressed',String(x.dataset.l==l)));
if(reduce)return;ts.forEach(t=>{const o=f.get(t),n=t.getBoundingClientRect();t.animate([{transform:'translate('+(o.left-n.left)+'px,'+(o.top-n.top)+'px) scale('+(o.width/n.width)+','+(o.height/n.height)+')'},{transform:'none'}],{duration:420,easing:'cubic-bezier(.2,.7,.2,1)'});});}
bs.forEach(x=>x.addEventListener('click',()=>set(x.dataset.l)));
</script>
</body></html>