ナビゲーション

v2.1.0
レイアウト

ベントーレイアウト

数種類のサイズのタイルをひとまとめにし、使える幅に応じてカラム数を変えるレイアウト。

このページの内容

ベントーレイアウトは、異なるサイズのタイルを 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>
「タブレット」、続いて「スマートフォン」を選ぶと、4 カラムが 2 カラム、次いで 1 カラムになります。各タイルがまたぐ範囲は、そのときのカラム数を超えません。

#仕組み

  • 自身の幅に応じた列数。 コンテナーは自身のサイズをクエリーできないため、ベントーレイアウトは自動グリッドと同じように、列の最小幅を指定して 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-wide2 列行全体1 セル
bento-tall2 行2 行1 セル
bento-large2 列 × 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>
「タブレット」、続けて「スマートフォン」を選んでください。行全体に広がるタイルはそのままで、ほかの拡張タイルは 2 列以上なら指定の範囲を占め、1 列になると 1 セルに戻ります。

複数セルにまたがるタイルは少数に絞ります。すべてを大きくすると、大きなタイルを並べた自動グリッドと同じになり、どれも大きくしなければ、最初に目を引くタイルがなくなります。

#配置順

タイルはマークアップ順に、直前のタイルより後で最初に収まる位置に配置されます。横長のタイルが行末に収まらなければ、そこに空きが残り、次の行の先頭に配置されます。後続のタイルでその空きを埋めると、見た目の順序と読み上げ順がずれるため、グリッドは空きを埋めません。キーボードでの移動とスクリーンリーダーでの読み上げは、マークアップの順序に従います。

タイルは空きが出にくい順序で記述します。ロゴや画像の一覧など、順序に意味がない場合は、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>
プレビュー内のベントーレイアウトの幅が 28rem 未満の場合、すべてのタイルが 1 セルに収まり、空きはできません。ウィンドウを広げると空きが見えます。

最初のベントーレイアウトでは、横長のタイルが収まらず、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-widebento の幅が 28rem 以上で 2 列分を占め、2 列構成では行全体に広がるタイル
bento-tallbento の幅が 28rem 以上で 2 行分を占めるタイル
bento-largebento の幅が 28rem 以上で 2 列 × 2 行を占めるタイル
bento-fullどの幅でも行全体に広がるタイル

#カスタムプロパティ

プロパティ既定値説明
--bento-row10rem行の最小高さ。行は最も背の高い内容に合わせて広がります。
--bento-gap1rem列数の算出にも使うタイル間隔

#ソース

@master/ui/layouts/bento.css
/* * Bento: a few tiles of different sizes fitted into one box, the way a product's features or a profile's * highlights are shown. It is a layout: it draws no surface; the tiles are cards, sheets or figures. * * What it knows is how many columns there are and how far a tile may span. Both follow the room the bento is * given, never the viewport: four columns from 48rem, two from 28rem, one below. The bento is a size container, * named bento, so the tiles read the same width the columns are counted from. The columns are counted without * a query on the bento itself (a container cannot query its own size): the narrowest a track may be jumps from a * quarter to a half to the whole of the width at those two thresholds, and auto-fill makes as many tracks as * that allows. A pixel is taken off each, so rounding never costs a column. * * A tile takes one cell. bento-wide spans two columns, bento-tall two rows, bento-large both, bento-full the * row. A span never asks for more columns than there are: in two columns a wide tile is the row, and in one * column every tile is one cell. Rows are at least --bento-row tall and grow with what they hold, so a tile * never cuts its words. * * Tiles are placed in the order of the markup, which is also the order a keyboard and a screen reader follow. * The grid does not move a later tile up into a hole: arrange the tiles so they pack, or add bento-dense to a * set whose order means nothing. */@layer components.ui {  .bento {    --bento-row: 10rem;    --bento-gap: 1rem;    display: grid;    grid-template-columns: repeat(auto-fill, minmax(calc(clamp(clamp((100% - var(--bento-gap) * 3) / 4, (48rem - 100%) * 999, (100% - var(--bento-gap)) / 2), (28rem - 100%) * 999, 100%) - 1px), 1fr));    grid-auto-rows: minmax(var(--bento-row), auto);    gap: var(--bento-gap);    min-width: 0;    margin: 0;    padding: 0;    list-style: none;    container: bento / inline-size;    &.bento-dense {      grid-auto-flow: row dense;    }  }  .bento-full {    grid-column: 1 / -1;  }  @container bento (inline-size >= 28rem) {    .bento-wide,    .bento-large {      grid-column: span 2;    }    .bento-tall,    .bento-large {      grid-row: span 2;    }  }}