ベントーレイアウト
数種類のサイズのタイルをひとまとめにし、使える幅に応じてカラム数を変えるレイアウト。
このページの内容
ベントーレイアウトは、異なるサイズのタイルを 1 つの枠に組み合わせます。製品の機能やプロフィールの見どころを、大きなタイル、その隣の縦長のタイル、周囲の小さなタイルで見せるときに使えます。ベントーレイアウト自体は面を描画せず、カードやシートとその中身をタイルとして配置します。
カラム数と各タイルがまたげるカラム数は、ベントーレイアウト自体が使える幅で決まり、ビューポートには依存しません。48rem 以上で 4 カラム、28rem 以上 48rem 未満で 2 カラム、28rem 未満で 1 カラムになります。幅の広いベントーレイアウトで 2 カラムをまたぐタイルは、2 カラム構成では行全体を、1 カラム構成では 1 セルを占めます。同じマークアップで、デスクトップではタイルを組み合わせた配置になり、スマートフォンでは縦一列に並びます。
ベントーレイアウト
<section class="flex flex-col gap-xl p-xl bg-surface-base fg-text-body text-sm" aria-labelledby="bento-title"> <header class="flex flex-col gap-xs max-w(560)"> <p class="eyebrow">Platform</p> <h2 class="heading heading-xl" id="bento-title">Everything a deploy needs</h2> </header> <div class="bento"> <article class="card card-split bento-large"> <img class="card-media" src="/demo/moonstone.svg" alt> <header class="card-header"> <h3 class="card-title">Live at the edge</h3> <p class="card-description"> Every push is served from 14 regions before the review is done. </p> </header> <p class="card-body"> Static files, functions and images are cached where the reader is, and purged the moment a deploy replaces them. </p> <footer class="card-footer"><a class="btn btn-sm" href="#regions">See the regions</a></footer> </article> <article class="card bento-tall"> <header class="card-header"> <h3 class="card-title">Reviewed together</h3> <p class="card-description">Comments land on the preview, beside what they are about.</p> </header> <div class="card-body flex flex-col gap-sm"> <div class="avatar-group" role="group" aria-label="Ada Lovelace, Alan Turing, Grace Hopper and 5 others"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-1.svg" alt> </span> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-2.svg" alt> </span> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-3.svg" alt> </span> <span class="avatar avatar-sm" aria-hidden="true">+5</span> </div> <p class="m(0)"> Eight people left 23 comments on this week's previews. Four are still open. </p> </div> <footer class="card-footer"><a class="btn btn-sm" href="#comments">Open comments</a></footer> </article> <article class="card"> <div class="stat"> <p class="stat-label">Cold builds</p> <div class="stat-row"> <p class="stat-value">38s</p> <p class="stat-delta">21% faster</p> </div> <p class="stat-description">Caches are restored before the install.</p> </div> </article> <article class="card"> <header class="card-header"> <h3 class="card-title">Rollbacks</h3> <p class="card-description">Any deploy is one click away, and so is the one before it.</p> </header> </article> <article class="card bento-wide"> <header class="card-header"> <h3 class="card-title">Builds this week</h3> <p class="card-description">Thursday so far</p> </header> <figure class="chart chart-quiet" style="--chart-height: 4.5rem"> <div class="chart-body"> <svg class="chart-plot" role="list" aria-label="Builds per day, this week"> <g aria-hidden="true"> <line class="chart-grid chart-grid-base" x1="0" y1="100%" x2="100%" y2="100%" /> <line class="chart-grid" x1="0" y1="75%" x2="100%" y2="75%" /> <line class="chart-grid" x1="0" y1="50%" x2="100%" y2="50%" /> <line class="chart-grid" x1="0" y1="25%" x2="100%" y2="25%" /> <line class="chart-grid" x1="0" y1="0%" x2="100%" y2="0%" /> <text class="chart-tick chart-tick-x" x="7.143%" y="100%">Mon</text> <text class="chart-tick chart-tick-x" x="21.429%" y="100%">Tue</text> <text class="chart-tick chart-tick-x" x="35.714%" y="100%">Wed</text> <text class="chart-tick chart-tick-x" x="50%" y="100%">Thu</text> <text class="chart-tick chart-tick-x" x="64.286%" y="100%">Fri</text> <text class="chart-tick chart-tick-x" x="78.571%" y="100%">Sat</text> <text class="chart-tick chart-tick-x" x="92.857%" y="100%">Sun</text> </g> <g class="chart-point" role="listitem" aria-label="Mon: 42"> <rect class="chart-hit" x="0%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="2.714%" y="47.5%" width="8.857%" height="52.5%" /> </g> <g class="chart-point" role="listitem" aria-label="Tue: 58"> <rect class="chart-hit" x="14.286%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="17%" y="27.5%" width="8.857%" height="72.5%" /> </g> <g class="chart-point" role="listitem" aria-label="Wed: 36"> <rect class="chart-hit" x="28.571%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="31.286%" y="55%" width="8.857%" height="45%" /> </g> <g class="chart-point" role="listitem" aria-label="Thu: 71" aria-current="true"> <rect class="chart-hit" x="42.857%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="45.571%" y="11.25%" width="8.857%" height="88.75%" /> </g> <g class="chart-point" role="listitem" aria-label="Fri: 0"> <rect class="chart-hit" x="57.143%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="59.857%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g class="chart-point" role="listitem" aria-label="Sat: 0"> <rect class="chart-hit" x="71.429%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="74.143%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g class="chart-point" role="listitem" aria-label="Sun: 0"> <rect class="chart-hit" x="85.714%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="88.429%" y="99.4%" width="8.857%" height="0.6%" /> </g> </svg> </div> </figure> </article> <article class="sheet sheet-inverse bento-wide flex flex-col justify-between gap-md p(20)"> <div class="flex flex-col gap-3xs"> <h3 class="heading heading-sm fg-text-inverse">Start on the free plan</h3> <p class="m(0)">Three projects and every feature above. No card needed.</p> </div> <div class="flex"><a class="btn btn-sm" href="#start">Create a project</a></div> </article> </div></section><section className="flex flex-col gap-xl p-xl bg-surface-base fg-text-body text-sm" aria-labelledby="bento-title"> <header className="flex flex-col gap-xs max-w(560)"> <p className="eyebrow">Platform</p> <h2 className="heading heading-xl" id="bento-title">Everything a deploy needs</h2> </header> <div className="bento"> <article className="card card-split bento-large"> <img className="card-media" src="/demo/moonstone.svg" alt="" /> <header className="card-header"> <h3 className="card-title">Live at the edge</h3> <p className="card-description"> Every push is served from 14 regions before the review is done. </p> </header> <p className="card-body"> Static files, functions and images are cached where the reader is, and purged the moment a deploy replaces them. </p> <footer className="card-footer"> <a className="btn btn-sm" href="#regions">See the regions</a> </footer> </article> <article className="card bento-tall"> <header className="card-header"> <h3 className="card-title">Reviewed together</h3> <p className="card-description"> Comments land on the preview, beside what they are about. </p> </header> <div className="card-body flex flex-col gap-sm"> <div className="avatar-group" role="group" aria-label="Ada Lovelace, Alan Turing, Grace Hopper and 5 others"> <span className="avatar avatar-sm"> <img className="avatar-image" src="/demo/portrait-1.svg" alt="" /> </span> <span className="avatar avatar-sm"> <img className="avatar-image" src="/demo/portrait-2.svg" alt="" /> </span> <span className="avatar avatar-sm"> <img className="avatar-image" src="/demo/portrait-3.svg" alt="" /> </span> <span className="avatar avatar-sm" aria-hidden="true">+5</span> </div> <p className="m(0)"> Eight people left 23 comments on this week's previews. Four are still open. </p> </div> <footer className="card-footer"> <a className="btn btn-sm" href="#comments">Open comments</a> </footer> </article> <article className="card"> <div className="stat"> <p className="stat-label">Cold builds</p> <div className="stat-row"> <p className="stat-value">38s</p> <p className="stat-delta">21% faster</p> </div> <p className="stat-description">Caches are restored before the install.</p> </div> </article> <article className="card"> <header className="card-header"> <h3 className="card-title">Rollbacks</h3> <p className="card-description"> Any deploy is one click away, and so is the one before it. </p> </header> </article> <article className="card bento-wide"> <header className="card-header"> <h3 className="card-title">Builds this week</h3> <p className="card-description">Thursday so far</p> </header> <figure className="chart chart-quiet" style={{ '--chart-height': '4.5rem' } as React.CSSProperties}> <div className="chart-body"> <svg className="chart-plot" role="list" aria-label="Builds per day, this week"> <g aria-hidden="true"> <line className="chart-grid chart-grid-base" x1="0" y1="100%" x2="100%" y2="100%" /> <line className="chart-grid" x1="0" y1="75%" x2="100%" y2="75%" /> <line className="chart-grid" x1="0" y1="50%" x2="100%" y2="50%" /> <line className="chart-grid" x1="0" y1="25%" x2="100%" y2="25%" /> <line className="chart-grid" x1="0" y1="0%" x2="100%" y2="0%" /> <text className="chart-tick chart-tick-x" x="7.143%" y="100%">Mon</text> <text className="chart-tick chart-tick-x" x="21.429%" y="100%">Tue</text> <text className="chart-tick chart-tick-x" x="35.714%" y="100%">Wed</text> <text className="chart-tick chart-tick-x" x="50%" y="100%">Thu</text> <text className="chart-tick chart-tick-x" x="64.286%" y="100%">Fri</text> <text className="chart-tick chart-tick-x" x="78.571%" y="100%">Sat</text> <text className="chart-tick chart-tick-x" x="92.857%" y="100%">Sun</text> </g> <g className="chart-point" role="listitem" aria-label="Mon: 42"> <rect className="chart-hit" x="0%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="2.714%" y="47.5%" width="8.857%" height="52.5%" /> </g> <g className="chart-point" role="listitem" aria-label="Tue: 58"> <rect className="chart-hit" x="14.286%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="17%" y="27.5%" width="8.857%" height="72.5%" /> </g> <g className="chart-point" role="listitem" aria-label="Wed: 36"> <rect className="chart-hit" x="28.571%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="31.286%" y="55%" width="8.857%" height="45%" /> </g> <g className="chart-point" role="listitem" aria-label="Thu: 71" aria-current="true"> <rect className="chart-hit" x="42.857%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="45.571%" y="11.25%" width="8.857%" height="88.75%" /> </g> <g className="chart-point" role="listitem" aria-label="Fri: 0"> <rect className="chart-hit" x="57.143%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="59.857%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g className="chart-point" role="listitem" aria-label="Sat: 0"> <rect className="chart-hit" x="71.429%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="74.143%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g className="chart-point" role="listitem" aria-label="Sun: 0"> <rect className="chart-hit" x="85.714%" y="0" width="14.286%" height="100%" /> <rect className="chart-bar" x="88.429%" y="99.4%" width="8.857%" height="0.6%" /> </g> </svg> </div> </figure> </article> <article className="sheet sheet-inverse bento-wide flex flex-col justify-between gap-md p(20)"> <div className="flex flex-col gap-3xs"> <h3 className="heading heading-sm fg-text-inverse">Start on the free plan</h3> <p className="m(0)">Three projects and every feature above. No card needed.</p> </div> <div className="flex"><a className="btn btn-sm" href="#start">Create a project</a></div> </article> </div></section><section class="flex flex-col gap-xl p-xl bg-surface-base fg-text-body text-sm" aria-labelledby="bento-title"> <header class="flex flex-col gap-xs max-w(560)"> <p class="eyebrow">Platform</p> <h2 class="heading heading-xl" id="bento-title">Everything a deploy needs</h2> </header> <div class="bento"> <article class="card card-split bento-large"> <img class="card-media" src="/demo/moonstone.svg" alt> <header class="card-header"> <h3 class="card-title">Live at the edge</h3> <p class="card-description"> Every push is served from 14 regions before the review is done. </p> </header> <p class="card-body"> Static files, functions and images are cached where the reader is, and purged the moment a deploy replaces them. </p> <footer class="card-footer"><a class="btn btn-sm" href="#regions">See the regions</a></footer> </article> <article class="card bento-tall"> <header class="card-header"> <h3 class="card-title">Reviewed together</h3> <p class="card-description">Comments land on the preview, beside what they are about.</p> </header> <div class="card-body flex flex-col gap-sm"> <div class="avatar-group" role="group" aria-label="Ada Lovelace, Alan Turing, Grace Hopper and 5 others"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-1.svg" alt> </span> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-2.svg" alt> </span> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-3.svg" alt> </span> <span class="avatar avatar-sm" aria-hidden="true">+5</span> </div> <p class="m(0)"> Eight people left 23 comments on this week's previews. Four are still open. </p> </div> <footer class="card-footer"><a class="btn btn-sm" href="#comments">Open comments</a></footer> </article> <article class="card"> <div class="stat"> <p class="stat-label">Cold builds</p> <div class="stat-row"> <p class="stat-value">38s</p> <p class="stat-delta">21% faster</p> </div> <p class="stat-description">Caches are restored before the install.</p> </div> </article> <article class="card"> <header class="card-header"> <h3 class="card-title">Rollbacks</h3> <p class="card-description">Any deploy is one click away, and so is the one before it.</p> </header> </article> <article class="card bento-wide"> <header class="card-header"> <h3 class="card-title">Builds this week</h3> <p class="card-description">Thursday so far</p> </header> <figure class="chart chart-quiet" style="--chart-height: 4.5rem"> <div class="chart-body"> <svg class="chart-plot" role="list" aria-label="Builds per day, this week"> <g aria-hidden="true"> <line class="chart-grid chart-grid-base" x1="0" y1="100%" x2="100%" y2="100%" /> <line class="chart-grid" x1="0" y1="75%" x2="100%" y2="75%" /> <line class="chart-grid" x1="0" y1="50%" x2="100%" y2="50%" /> <line class="chart-grid" x1="0" y1="25%" x2="100%" y2="25%" /> <line class="chart-grid" x1="0" y1="0%" x2="100%" y2="0%" /> <text class="chart-tick chart-tick-x" x="7.143%" y="100%">Mon</text> <text class="chart-tick chart-tick-x" x="21.429%" y="100%">Tue</text> <text class="chart-tick chart-tick-x" x="35.714%" y="100%">Wed</text> <text class="chart-tick chart-tick-x" x="50%" y="100%">Thu</text> <text class="chart-tick chart-tick-x" x="64.286%" y="100%">Fri</text> <text class="chart-tick chart-tick-x" x="78.571%" y="100%">Sat</text> <text class="chart-tick chart-tick-x" x="92.857%" y="100%">Sun</text> </g> <g class="chart-point" role="listitem" aria-label="Mon: 42"> <rect class="chart-hit" x="0%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="2.714%" y="47.5%" width="8.857%" height="52.5%" /> </g> <g class="chart-point" role="listitem" aria-label="Tue: 58"> <rect class="chart-hit" x="14.286%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="17%" y="27.5%" width="8.857%" height="72.5%" /> </g> <g class="chart-point" role="listitem" aria-label="Wed: 36"> <rect class="chart-hit" x="28.571%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="31.286%" y="55%" width="8.857%" height="45%" /> </g> <g class="chart-point" role="listitem" aria-label="Thu: 71" aria-current="true"> <rect class="chart-hit" x="42.857%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="45.571%" y="11.25%" width="8.857%" height="88.75%" /> </g> <g class="chart-point" role="listitem" aria-label="Fri: 0"> <rect class="chart-hit" x="57.143%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="59.857%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g class="chart-point" role="listitem" aria-label="Sat: 0"> <rect class="chart-hit" x="71.429%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="74.143%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g class="chart-point" role="listitem" aria-label="Sun: 0"> <rect class="chart-hit" x="85.714%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="88.429%" y="99.4%" width="8.857%" height="0.6%" /> </g> </svg> </div> </figure> </article> <article class="sheet sheet-inverse bento-wide flex flex-col justify-between gap-md p(20)"> <div class="flex flex-col gap-3xs"> <h3 class="heading heading-sm fg-text-inverse">Start on the free plan</h3> <p class="m(0)">Three projects and every feature above. No card needed.</p> </div> <div class="flex"><a class="btn btn-sm" href="#start">Create a project</a></div> </article> </div></section><template> <section class="flex flex-col gap-xl p-xl bg-surface-base fg-text-body text-sm" aria-labelledby="bento-title"> <header class="flex flex-col gap-xs max-w(560)"> <p class="eyebrow">Platform</p> <h2 class="heading heading-xl" id="bento-title">Everything a deploy needs</h2> </header> <div class="bento"> <article class="card card-split bento-large"> <img class="card-media" src="/demo/moonstone.svg" alt> <header class="card-header"> <h3 class="card-title">Live at the edge</h3> <p class="card-description"> Every push is served from 14 regions before the review is done. </p> </header> <p class="card-body"> Static files, functions and images are cached where the reader is, and purged the moment a deploy replaces them. </p> <footer class="card-footer"> <a class="btn btn-sm" href="#regions">See the regions</a> </footer> </article> <article class="card bento-tall"> <header class="card-header"> <h3 class="card-title">Reviewed together</h3> <p class="card-description">Comments land on the preview, beside what they are about.</p> </header> <div class="card-body flex flex-col gap-sm"> <div class="avatar-group" role="group" aria-label="Ada Lovelace, Alan Turing, Grace Hopper and 5 others"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-1.svg" alt> </span> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-2.svg" alt> </span> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/portrait-3.svg" alt> </span> <span class="avatar avatar-sm" aria-hidden="true">+5</span> </div> <p class="m(0)"> Eight people left 23 comments on this week's previews. Four are still open. </p> </div> <footer class="card-footer"> <a class="btn btn-sm" href="#comments">Open comments</a> </footer> </article> <article class="card"> <div class="stat"> <p class="stat-label">Cold builds</p> <div class="stat-row"> <p class="stat-value">38s</p> <p class="stat-delta">21% faster</p> </div> <p class="stat-description">Caches are restored before the install.</p> </div> </article> <article class="card"> <header class="card-header"> <h3 class="card-title">Rollbacks</h3> <p class="card-description">Any deploy is one click away, and so is the one before it.</p> </header> </article> <article class="card bento-wide"> <header class="card-header"> <h3 class="card-title">Builds this week</h3> <p class="card-description">Thursday so far</p> </header> <figure class="chart chart-quiet" style="--chart-height: 4.5rem"> <div class="chart-body"> <svg class="chart-plot" role="list" aria-label="Builds per day, this week"> <g aria-hidden="true"> <line class="chart-grid chart-grid-base" x1="0" y1="100%" x2="100%" y2="100%" /> <line class="chart-grid" x1="0" y1="75%" x2="100%" y2="75%" /> <line class="chart-grid" x1="0" y1="50%" x2="100%" y2="50%" /> <line class="chart-grid" x1="0" y1="25%" x2="100%" y2="25%" /> <line class="chart-grid" x1="0" y1="0%" x2="100%" y2="0%" /> <text class="chart-tick chart-tick-x" x="7.143%" y="100%">Mon</text> <text class="chart-tick chart-tick-x" x="21.429%" y="100%">Tue</text> <text class="chart-tick chart-tick-x" x="35.714%" y="100%">Wed</text> <text class="chart-tick chart-tick-x" x="50%" y="100%">Thu</text> <text class="chart-tick chart-tick-x" x="64.286%" y="100%">Fri</text> <text class="chart-tick chart-tick-x" x="78.571%" y="100%">Sat</text> <text class="chart-tick chart-tick-x" x="92.857%" y="100%">Sun</text> </g> <g class="chart-point" role="listitem" aria-label="Mon: 42"> <rect class="chart-hit" x="0%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="2.714%" y="47.5%" width="8.857%" height="52.5%" /> </g> <g class="chart-point" role="listitem" aria-label="Tue: 58"> <rect class="chart-hit" x="14.286%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="17%" y="27.5%" width="8.857%" height="72.5%" /> </g> <g class="chart-point" role="listitem" aria-label="Wed: 36"> <rect class="chart-hit" x="28.571%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="31.286%" y="55%" width="8.857%" height="45%" /> </g> <g class="chart-point" role="listitem" aria-label="Thu: 71" aria-current="true"> <rect class="chart-hit" x="42.857%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="45.571%" y="11.25%" width="8.857%" height="88.75%" /> </g> <g class="chart-point" role="listitem" aria-label="Fri: 0"> <rect class="chart-hit" x="57.143%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="59.857%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g class="chart-point" role="listitem" aria-label="Sat: 0"> <rect class="chart-hit" x="71.429%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="74.143%" y="99.4%" width="8.857%" height="0.6%" /> </g> <g class="chart-point" role="listitem" aria-label="Sun: 0"> <rect class="chart-hit" x="85.714%" y="0" width="14.286%" height="100%" /> <rect class="chart-bar" x="88.429%" y="99.4%" width="8.857%" height="0.6%" /> </g> </svg> </div> </figure> </article> <article class="sheet sheet-inverse bento-wide flex flex-col justify-between gap-md p(20)"> <div class="flex flex-col gap-3xs"> <h3 class="heading heading-sm fg-text-inverse">Start on the free plan</h3> <p class="m(0)">Three projects and every feature above. No card needed.</p> </div> <div class="flex"><a class="btn btn-sm" href="#start">Create a project</a></div> </article> </div> </section></template>#仕組み
- 自身の幅に応じた列数。 コンテナーは自身のサイズをクエリーできないため、ベントーレイアウトは自動グリッドと同じように、列の最小幅を指定して
repeat(auto-fill, …)で列数を決めます。列の最小幅は、48rem 以上なら全体の 4 分の 1、28rem 以上なら半分、それ未満なら全幅です。auto-fill で並ぶ列は 4 列、2 列、1 列のいずれかで、3 列にはなりません。 - 列数に応じたタイルの広がり。 ベントーレイアウトは
bentoという名前のサイズコンテナーで、列数を決めるときと同じ幅を基準にします。bento-wide、bento-tall、bento-largeでタイルが複数のセルにまたがるのは、ベントーレイアウトの幅が 28rem 以上になり、2 列以上並ぶ場合だけです。bento-fullはどの幅でも行全体に広がります。 - 行の最小高。 行の最小の高さは
--bento-rowで指定し、既定は 10rem です。行は内容に応じて伸びます。縦長のタイルは、内容にかかわらず、2 行とその間の余白を占めます。 - マークアップ順に並ぶタイル。 上の 6 枚は、4 列でも 2 列でも収まりよく並ぶ順に記述しています。まず大きなタイルと縦長のタイル、次に縦長のタイルの隣の列を埋める小さなタイル 2 枚、最後に横長のタイル 2 枚です。
- タイル自体がコンポーネント。 分割カードは、タイルが広いときは画像をテキストの横に、狭いときは上に配置します。数値の表示には統計指標と控えめなチャートを使い、最後のタイルにはこのページで唯一の反転シートを使っています。
#タイル
クラスを指定しないタイルは 1 セルを占めます。タイルを拡張するクラスは 4 種類あります。
| クラス | 4 列の場合 | 2 列の場合 | 1 列の場合 |
|---|---|---|---|
bento-wide | 2 列 | 行全体 | 1 セル |
bento-tall | 2 行 | 2 行 | 1 セル |
bento-large | 2 列 × 2 行 | 全幅 × 2 行 | 1 セル |
bento-full | 行全体 | 行全体 | 行全体 |
タイル
<div class="bento p-lg bg-surface-base fg-text-muted text-2xl font-mono" style="--bento-row: 5rem"> <div class="well flex items-center justify-center bento-large">bento-large</div> <div class="well flex items-center justify-center bento-tall">bento-tall</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center bento-wide">bento-wide</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center bento-full">bento-full</div></div><div className="bento p-lg bg-surface-base fg-text-muted text-2xl font-mono" style={{ '--bento-row': '5rem' } as React.CSSProperties}> <div className="well flex items-center justify-center bento-large">bento-large</div> <div className="well flex items-center justify-center bento-tall">bento-tall</div> <div className="well flex items-center justify-center">One cell</div> <div className="well flex items-center justify-center">One cell</div> <div className="well flex items-center justify-center bento-wide">bento-wide</div> <div className="well flex items-center justify-center">One cell</div> <div className="well flex items-center justify-center">One cell</div> <div className="well flex items-center justify-center bento-full">bento-full</div></div><div class="bento p-lg bg-surface-base fg-text-muted text-2xl font-mono" style="--bento-row: 5rem"> <div class="well flex items-center justify-center bento-large">bento-large</div> <div class="well flex items-center justify-center bento-tall">bento-tall</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center bento-wide">bento-wide</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center bento-full">bento-full</div></div><template> <div class="bento p-lg bg-surface-base fg-text-muted text-2xl font-mono" style="--bento-row: 5rem"> <div class="well flex items-center justify-center bento-large">bento-large</div> <div class="well flex items-center justify-center bento-tall">bento-tall</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center bento-wide">bento-wide</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center">One cell</div> <div class="well flex items-center justify-center bento-full">bento-full</div> </div></template>複数セルにまたがるタイルは少数に絞ります。すべてを大きくすると、大きなタイルを並べた自動グリッドと同じになり、どれも大きくしなければ、最初に目を引くタイルがなくなります。
#配置順
タイルはマークアップ順に、直前のタイルより後で最初に収まる位置に配置されます。横長のタイルが行末に収まらなければ、そこに空きが残り、次の行の先頭に配置されます。後続のタイルでその空きを埋めると、見た目の順序と読み上げ順がずれるため、グリッドは空きを埋めません。キーボードでの移動とスクリーンリーダーでの読み上げは、マークアップの順序に従います。
タイルは空きが出にくい順序で記述します。ロゴや画像の一覧など、順序に意味がない場合は、bento-dense で後続のタイルを手前の空きに詰められます。
配置順
<div class="flex flex-col gap-md w-full fg-text-muted text-sm"> <p class="eyebrow">bento</p> <div class="bento" style="--bento-row: 3rem"> <div class="well flex items-center justify-center">1</div> <div class="well flex items-center justify-center bento-wide">2</div> <div class="well flex items-center justify-center bento-wide">3</div> <div class="well flex items-center justify-center">4</div> <div class="well flex items-center justify-center">5</div> </div> <p class="eyebrow">bento bento-dense</p> <div class="bento bento-dense" style="--bento-row: 3rem"> <div class="well flex items-center justify-center">1</div> <div class="well flex items-center justify-center bento-wide">2</div> <div class="well flex items-center justify-center bento-wide">3</div> <div class="well flex items-center justify-center">4</div> <div class="well flex items-center justify-center">5</div> </div></div><div className="flex flex-col gap-md w-full fg-text-muted text-sm"> <p className="eyebrow">bento</p> <div className="bento" style={{ '--bento-row': '3rem' } as React.CSSProperties}> <div className="well flex items-center justify-center">1</div> <div className="well flex items-center justify-center bento-wide">2</div> <div className="well flex items-center justify-center bento-wide">3</div> <div className="well flex items-center justify-center">4</div> <div className="well flex items-center justify-center">5</div> </div> <p className="eyebrow">bento bento-dense</p> <div className="bento bento-dense" style={{ '--bento-row': '3rem' } as React.CSSProperties}> <div className="well flex items-center justify-center">1</div> <div className="well flex items-center justify-center bento-wide">2</div> <div className="well flex items-center justify-center bento-wide">3</div> <div className="well flex items-center justify-center">4</div> <div className="well flex items-center justify-center">5</div> </div></div><div class="flex flex-col gap-md w-full fg-text-muted text-sm"> <p class="eyebrow">bento</p> <div class="bento" style="--bento-row: 3rem"> <div class="well flex items-center justify-center">1</div> <div class="well flex items-center justify-center bento-wide">2</div> <div class="well flex items-center justify-center bento-wide">3</div> <div class="well flex items-center justify-center">4</div> <div class="well flex items-center justify-center">5</div> </div> <p class="eyebrow">bento bento-dense</p> <div class="bento bento-dense" style="--bento-row: 3rem"> <div class="well flex items-center justify-center">1</div> <div class="well flex items-center justify-center bento-wide">2</div> <div class="well flex items-center justify-center bento-wide">3</div> <div class="well flex items-center justify-center">4</div> <div class="well flex items-center justify-center">5</div> </div></div><template> <div class="flex flex-col gap-md w-full fg-text-muted text-sm"> <p class="eyebrow">bento</p> <div class="bento" style="--bento-row: 3rem"> <div class="well flex items-center justify-center">1</div> <div class="well flex items-center justify-center bento-wide">2</div> <div class="well flex items-center justify-center bento-wide">3</div> <div class="well flex items-center justify-center">4</div> <div class="well flex items-center justify-center">5</div> </div> <p class="eyebrow">bento bento-dense</p> <div class="bento bento-dense" style="--bento-row: 3rem"> <div class="well flex items-center justify-center">1</div> <div class="well flex items-center justify-center bento-wide">2</div> <div class="well flex items-center justify-center bento-wide">3</div> <div class="well flex items-center justify-center">4</div> <div class="well flex items-center justify-center">5</div> </div> </div></template>最初のベントーレイアウトでは、横長のタイルが収まらず、1 枚目の後ろに空きができます。2 つ目では、4 枚目がその空きを埋めます。見た目では 2 番目ですが、読み上げでは 4 番目のままです。
#行
--bento-row は行の最小高で、既定は 10rem です。テキストが多いタイルに合わせて行が伸び、隣のタイルも同じ高さに広がるため、内容は途中で切れません。このページで図に使っている 5rem のように、数値や 1 行のテキストを載せるタイルでは値を小さくし、画像を載せるタイルでは大きくします。
--bento-gap はタイル間の余白で、値は 1rem です。列数の計算にも使うため、gap ユーティリティではなくプロパティで指定します。
#使い分け
| タイルの構成 | 使うもの |
|---|---|
| 複数のサイズで、一部を強調する | ベントーレイアウト |
| 同じサイズで、件数に応じて並べる | 自動グリッド |
| ギャラリーのように、内容に応じて高さが変わる | Masonry |
| デザインで列数が決まっている | grid grid-cols(3) と grid-col-span(2) をコンテナーバリアントと併用 |
ベントーレイアウトは、6〜10 枚のタイルをあらかじめ配置した構成に適しています。プロジェクト一覧や検索結果のように、項目が増え、どのタイルも同じ重要度で扱う一覧には、自動グリッドを使います。
#アクセシビリティ
- マークアップ順が、読み上げ順とキーボードでの移動順になります。最も重要なタイルを先頭に記述し、
bento-denseは順序に意味がない場合に限って使います。 - サイズによる強調は、スクリーンリーダーでは伝わりません。大きなタイルには読者が最も必要とする情報を見出しに置き、各見出しにはタイルの内容を示します。見出し一覧だけでも、タイル全体の構成がわかるようにします。
- タイル全体を 1 つのリンクにする場合は、リンク要素自体をカードにして
card-interactiveを指定します。カードにリンクを重ねる方法は避けます。
#クラス
| クラス | 説明 |
|---|---|
bento | グリッド自体の幅が 48rem 以上なら 4 列、28rem 以上 48rem 未満なら 2 列、それ未満なら 1 列です。各行の高さは最低 --bento-row です。bento という名前のサイズコンテナーで、グリッド自体は何も描画しません。 |
bento-dense | 先のタイルが複数のセルにまたがってできた空きに、後続のタイルが繰り上がります。見た目の順序が文書上の順序と異なるため、項目の順序に意味がない場合に限って使います。bento と併用します |
bento-wide | bento の幅が 28rem 以上で 2 列分を占め、2 列構成では行全体に広がるタイル |
bento-tall | bento の幅が 28rem 以上で 2 行分を占めるタイル |
bento-large | bento の幅が 28rem 以上で 2 列 × 2 行を占めるタイル |
bento-full | どの幅でも行全体に広がるタイル |
#カスタムプロパティ
| プロパティ | 既定値 | 説明 |
|---|---|---|
--bento-row | 10rem | 行の最小高さ。行は最も背の高い内容に合わせて広がります。 |
--bento-gap | 1rem | 列数の算出にも使うタイル間隔 |
#関連項目
- 自動グリッド収まる数だけ等幅のカラムを並べ、カラム数をグリッド自身が決めます。
- メイソンリー高さの異なるタイルを、下に空きを残さず列に詰めて配置します。
- カード背景面から浮き上がり、割り当てられたスペースに合わせて内部のレイアウトが変わるシート。
- 統計指標1 つの数値と、その測定対象や変化を表示します。控えめなラベル、大きな値、増減で構成します。
- チャート折れ線グラフからサンバーストまで、20種類以上の形式で数値を表示します。どの形式も、表示幅に収まる1つのSVGで描画します。
- サーフェストレイ、シート、ウェル。すべてのコンポーネントの土台となる、奥行きの異なる素材です。