ナビゲーション

v2.1.0
アプリケーションのブロック

サイドバー

ワークスペース、ナビゲーション、アカウントをまとめたアプリのサイドバー。

アプリのサイドバーには、上から順に、現在のワークスペース、移動先、現在のアカウントを表示します。このブロックは、アプリシェルの shell-sidebar 領域にこれらを配置します。

サイドバー

<div class="shell bg-surface-tray fg-text-body text-sm">  <a class="skip" href="#sb-main">Skip to content</a>  <aside class="shell-sidebar gap-sm p-sm">    <button type="button" class="btn btn-quiet justify-start px(6)" popovertarget="sb-workspace">      <span class="avatar avatar-xs avatar-square" aria-hidden="true">A</span> Atlas Labs <span class="ml-auto fg-text-muted">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M10.25 5L13.1086 7.8586A0.2 0.2 0 0 1 13.1086 8.1414L10.25 11" transform="rotate(-90 8 8)" /><path d="M10.25 5L13.1086 7.8586A0.2 0.2 0 0 1 13.1086 8.1414L10.25 11" transform="rotate(90 8 8)" />        </svg>      </span>    </button>    <div class="menu" id="sb-workspace" popover>      <div class="menu-label">Workspaces</div>      <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">        Atlas Labs      </button>      <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">        Personal      </button>      <hr class="menu-separator">      <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M3 8L13 8" /><path d="M8 3L8 13" />        </svg>New workspace      </button>    </div>    <label class="input-group input-group-sm">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <circle cx="7" cy="7" r="4.5" /><path d="M10.182 10.182L14 14" />      </svg>      <input class="input-group-field" type="search" placeholder="Search" aria-label="Search">      <kbd class="kbd">⌘</kbd><kbd class="kbd">K</kbd>    </label>    <nav class="nav" aria-label="Workspace">      <a class="nav-item" href="#">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M3 13L3 6.9624A1 1 0 0 1 3.3524 6.2005L7.3524 2.8005A1 1 0 0 1 8.6476 2.8005L12.6476 6.2005A1 1 0 0 1 13 6.9624L13 13A1 1 0 0 1 12 14L4 14A1 1 0 0 1 3 13Z" /><path d="M6.5 14L6.5 11A1 1 0 0 1 7.5 10L8.5 10A1 1 0 0 1 9.5 11L9.5 14" />        </svg>Overview      </a>      <a class="nav-item" href="#" aria-current="page">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <rect x="2.5" y="2.5" width="4" height="4" rx="1" /><rect x="9.5" y="2.5" width="4" height="4" rx="1" /><rect x="2.5" y="9.5" width="4" height="4" rx="1" /><rect x="9.5" y="9.5" width="4" height="4" rx="1" />        </svg>Projects<span class="nav-end">12</span>      </a>      <details class="nav-group" open>        <summary class="nav-item nav-toggle">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <path d="M8 1.3333C4 4.6667 3.6667 8.6667 5.6667 12.3333H10.3333C12.3333 8.6667 12 4.6667 8 1.3333Z" /><circle cx="8" cy="6.6667" r="0.85" fill="currentColor" stroke="none" /><path d="M10.016 12.3333Q10.1079 12.4463 10.2446 12.5147L12.5342 13.6594A0.6999 0.6999 0 0 0 13.5377 13.1484L14.1443 9.5091Q14.1989 9.1824 13.9807 8.9328L11.9808 6.6473A0.7011 0.7011 0 0 0 11.3582 6.4146C11.5022 7.0678 11.5536 7.7269 11.5195 8.3865L11.635 7.7707L13.1346 9.4845L12.6181 12.5833L10.8942 11.7215L11.1203 10.5157C10.924 11.1275 10.6597 11.7349 10.3333 12.3333H10.016ZM4.6418 6.4146A0.6958 0.6958 0 0 0 4.0192 6.6473L2.0193 8.9328Q1.8012 9.1824 1.8557 9.5091L2.4623 13.1484A0.6999 0.6999 0 0 0 3.4658 13.6594L5.7554 12.5147Q5.8921 12.4463 5.984 12.3333H5.6667C5.3403 11.7349 5.076 11.1275 4.8797 10.5157L5.1058 11.7215L3.3819 12.5833L2.8654 9.4845L4.365 7.7707L4.4805 8.3865C4.4464 7.7269 4.4978 7.0678 4.6418 6.4146Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M6.6667 15L9.3333 15" />          </svg>Deployments<svg class="icon nav-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" />          </svg>        </summary>        <div class="nav-sub">          <a class="nav-item" href="#">Production</a>          <a class="nav-item" href="#">Preview<span class="nav-end">3</span></a>        </div>      </details>      <a class="nav-item" href="#">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <circle cx="8" cy="8" r="6" /><path d="M8.7707 2.0497A6.0005 6.0005 0 0 0 7.2293 2.0497Q6.1162 3.1938 5.4813 4.6077Q4.8542 6.0044 4.7648 7.5H2.0209A5.9913 5.9913 0 0 0 2.0209 8.5H4.7648Q4.8542 9.9956 5.4813 11.3923Q6.1162 12.8062 7.2293 13.9503A6.0005 6.0005 0 0 0 8.7707 13.9503Q9.8838 12.8062 10.5187 11.3923Q11.1458 9.9956 11.2352 8.5H13.9791A5.9913 5.9913 0 0 0 13.9791 7.5H11.2352Q11.1458 6.0044 10.5187 4.6077Q9.8838 3.1938 8.7707 2.0497ZM9.6064 5.0173Q10.1455 6.2181 10.2331 7.5H5.7669Q5.8545 6.2181 6.3936 5.0173Q6.971 3.7314 8 2.6921Q9.029 3.7314 9.6064 5.0173ZM6.3936 10.9827Q5.8545 9.7819 5.7669 8.5H10.2331Q10.1455 9.7819 9.6064 10.9827Q9.029 12.2686 8 13.3079Q6.971 12.2686 6.3936 10.9827Z" fill="currentColor" stroke="none" fill-rule="evenodd" />        </svg>Domains      </a>      <a class="nav-item" href="#">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <rect x="2" y="8" width="2.5" height="6" rx="0.75" /><rect x="6.75" y="3" width="2.5" height="11" rx="0.75" /><rect x="11.5" y="6" width="2.5" height="8" rx="0.75" />        </svg>Analytics      </a>      <div class="nav-label">Team</div>      <a class="nav-item" href="#">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <circle cx="6.25" cy="4.5" r="2" /><path d="M2.25 13.75V12.5C2.25 10.7 3.85 9.5 5.35 9.5H7.15C8.65 9.5 10.25 10.7 10.25 12.5V13.75" /><path d="M11.1 2.6C13.8 2.6 13.8 6.6 11.1 6.6" /><path d="M12 9.5C13.5 9.75 14.25 11.25 14.25 12.5V13.75" />        </svg>Members      </a>      <a class="nav-item" href="#">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <rect x="1.6667" y="3.3333" width="12.6667" height="9.3333" rx="1" /><path d="M1.6667 6.6667L14.3333 6.6667" /><path d="M4 10L6.6667 10" />        </svg>Billing      </a>      <a class="nav-item" href="#">        <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">          <path d="M2.5 4.5L4.5 4.5" /><circle cx="6" cy="4.5" r="1.5" /><path d="M7.5 4.5L13.5 4.5" /><path d="M2.5 11.5L8.5 11.5" /><circle cx="10" cy="11.5" r="1.5" /><path d="M11.5 11.5L13.5 11.5" />        </svg>Settings      </a>    </nav>    <div class="flex flex-col gap-sm mt-auto">      <section class="well flex flex-col gap-xs p-sm" aria-labelledby="sb-usage">        <div class="flex items-baseline justify-between gap-sm text-xs">          <span class="fg-text-strong" id="sb-usage">Build minutes</span>          <span class="fg-text-muted">296 of 400</span>        </div>        <meter class="meter meter-sm" min="0" max="400" low="240" high="360" optimum="0" value="296" aria-labelledby="sb-usage">          296 of 400 build minutes        </meter>        <a class="link text-xs self-start" href="#">Upgrade</a>      </section>      <button type="button" class="btn btn-quiet justify-start px(6)" popovertarget="sb-account">        <span class="avatar avatar-xs">          <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256">        </span> Yi-ching Lin <span class="ml-auto fg-text-muted">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <circle cx="3.5" cy="8" r="1.05" fill="currentColor" stroke="none" /><circle cx="8" cy="8" r="1.05" fill="currentColor" stroke="none" /><circle cx="12.5" cy="8" r="1.05" fill="currentColor" stroke="none" />          </svg>        </span>      </button>      <div class="menu menu-top" id="sb-account" popover>        <a class="menu-item" href="#">Account settings</a>        <a class="menu-item" href="#">Keyboard shortcuts</a>        <hr class="menu-separator">        <button type="button" class="menu-item" popovertarget="sb-account" popovertargetaction="hide">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <path d="M6.6667 2.6667L3.6667 2.6667A1 1 0 0 0 2.6667 3.6667L2.6667 12.3333A1 1 0 0 0 3.6667 13.3333L6.6667 13.3333" /><path d="M14.285 7.5892A0.4996 0.4996 0 0 0 14 7.5L6.6422 7.5006A0.5 0.5 0 0 0 6.5933 8.4946L6.6667 8.5L14.0379 8.4986A0.5007 0.5007 0 0 0 14.285 8.4108A0.7044 0.7044 0 0 0 14.285 7.5892Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M10.6667 4.6667L13.8586 7.8586A0.2 0.2 0 0 1 13.8586 8.1414L10.6667 11.3333" />          </svg>Sign out        </button>      </div>    </div>  </aside>  <div class="shell-main flex flex-col gap(8) p(8) pxs(0)@container(--3xl)">    <button type="button" class="btn btn-sm shell-toggle self-start" commandfor="sb-drawer" command="show-modal">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M2.6667 4L13.3333 4" /><path d="M2.6667 8L13.3333 8" /><path d="M2.6667 12L13.3333 12" />      </svg>Menu    </button>    <main class="sheet grow(1) flex items-center justify-center p-xl" id="sb-main" tabindex="-1">      <p class="m(0) fg-text-muted text-center max-w(320)">        The sidebar is the block. The sheet beside it is where the page goes.      </p>    </main>  </div>  <dialog class="dialog dialog-drawer dialog-drawer-start" id="sb-drawer" closedby="any" aria-label="Navigation">    <div class="dialog-body flex flex-col gap-sm">      <p class="m(0) px-xs h(32) flex items-center fg-text-strong font-medium">Atlas Labs</p>      <nav class="nav" aria-label="Workspace, in the drawer">        <a class="nav-item" href="#">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <path d="M3 13L3 6.9624A1 1 0 0 1 3.3524 6.2005L7.3524 2.8005A1 1 0 0 1 8.6476 2.8005L12.6476 6.2005A1 1 0 0 1 13 6.9624L13 13A1 1 0 0 1 12 14L4 14A1 1 0 0 1 3 13Z" /><path d="M6.5 14L6.5 11A1 1 0 0 1 7.5 10L8.5 10A1 1 0 0 1 9.5 11L9.5 14" />          </svg>Overview        </a>        <a class="nav-item" href="#" aria-current="page">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <rect x="2.5" y="2.5" width="4" height="4" rx="1" /><rect x="9.5" y="2.5" width="4" height="4" rx="1" /><rect x="2.5" y="9.5" width="4" height="4" rx="1" /><rect x="9.5" y="9.5" width="4" height="4" rx="1" />          </svg>Projects<span class="nav-end">12</span>        </a>        <details class="nav-group" open>          <summary class="nav-item nav-toggle">            <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">              <path d="M8 1.3333C4 4.6667 3.6667 8.6667 5.6667 12.3333H10.3333C12.3333 8.6667 12 4.6667 8 1.3333Z" /><circle cx="8" cy="6.6667" r="0.85" fill="currentColor" stroke="none" /><path d="M10.016 12.3333Q10.1079 12.4463 10.2446 12.5147L12.5342 13.6594A0.6999 0.6999 0 0 0 13.5377 13.1484L14.1443 9.5091Q14.1989 9.1824 13.9807 8.9328L11.9808 6.6473A0.7011 0.7011 0 0 0 11.3582 6.4146C11.5022 7.0678 11.5536 7.7269 11.5195 8.3865L11.635 7.7707L13.1346 9.4845L12.6181 12.5833L10.8942 11.7215L11.1203 10.5157C10.924 11.1275 10.6597 11.7349 10.3333 12.3333H10.016ZM4.6418 6.4146A0.6958 0.6958 0 0 0 4.0192 6.6473L2.0193 8.9328Q1.8012 9.1824 1.8557 9.5091L2.4623 13.1484A0.6999 0.6999 0 0 0 3.4658 13.6594L5.7554 12.5147Q5.8921 12.4463 5.984 12.3333H5.6667C5.3403 11.7349 5.076 11.1275 4.8797 10.5157L5.1058 11.7215L3.3819 12.5833L2.8654 9.4845L4.365 7.7707L4.4805 8.3865C4.4464 7.7269 4.4978 7.0678 4.6418 6.4146Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M6.6667 15L9.3333 15" />            </svg>Deployments<svg class="icon nav-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">              <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" />            </svg>          </summary>          <div class="nav-sub">            <a class="nav-item" href="#">Production</a>            <a class="nav-item" href="#">Preview<span class="nav-end">3</span></a>          </div>        </details>        <a class="nav-item" href="#">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <circle cx="8" cy="8" r="6" /><path d="M8.7707 2.0497A6.0005 6.0005 0 0 0 7.2293 2.0497Q6.1162 3.1938 5.4813 4.6077Q4.8542 6.0044 4.7648 7.5H2.0209A5.9913 5.9913 0 0 0 2.0209 8.5H4.7648Q4.8542 9.9956 5.4813 11.3923Q6.1162 12.8062 7.2293 13.9503A6.0005 6.0005 0 0 0 8.7707 13.9503Q9.8838 12.8062 10.5187 11.3923Q11.1458 9.9956 11.2352 8.5H13.9791A5.9913 5.9913 0 0 0 13.9791 7.5H11.2352Q11.1458 6.0044 10.5187 4.6077Q9.8838 3.1938 8.7707 2.0497ZM9.6064 5.0173Q10.1455 6.2181 10.2331 7.5H5.7669Q5.8545 6.2181 6.3936 5.0173Q6.971 3.7314 8 2.6921Q9.029 3.7314 9.6064 5.0173ZM6.3936 10.9827Q5.8545 9.7819 5.7669 8.5H10.2331Q10.1455 9.7819 9.6064 10.9827Q9.029 12.2686 8 13.3079Q6.971 12.2686 6.3936 10.9827Z" fill="currentColor" stroke="none" fill-rule="evenodd" />          </svg>Domains        </a>        <a class="nav-item" href="#">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <rect x="2" y="8" width="2.5" height="6" rx="0.75" /><rect x="6.75" y="3" width="2.5" height="11" rx="0.75" /><rect x="11.5" y="6" width="2.5" height="8" rx="0.75" />          </svg>Analytics        </a>        <div class="nav-label">Team</div>        <a class="nav-item" href="#">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <circle cx="6.25" cy="4.5" r="2" /><path d="M2.25 13.75V12.5C2.25 10.7 3.85 9.5 5.35 9.5H7.15C8.65 9.5 10.25 10.7 10.25 12.5V13.75" /><path d="M11.1 2.6C13.8 2.6 13.8 6.6 11.1 6.6" /><path d="M12 9.5C13.5 9.75 14.25 11.25 14.25 12.5V13.75" />          </svg>Members        </a>        <a class="nav-item" href="#">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <rect x="1.6667" y="3.3333" width="12.6667" height="9.3333" rx="1" /><path d="M1.6667 6.6667L14.3333 6.6667" /><path d="M4 10L6.6667 10" />          </svg>Billing        </a>        <a class="nav-item" href="#">          <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">            <path d="M2.5 4.5L4.5 4.5" /><circle cx="6" cy="4.5" r="1.5" /><path d="M7.5 4.5L13.5 4.5" /><path d="M2.5 11.5L8.5 11.5" /><circle cx="10" cy="11.5" r="1.5" /><path d="M11.5 11.5L13.5 11.5" />          </svg>Settings        </a>      </nav>    </div>    <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="sb-drawer" command="close" aria-label="Close navigation">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M4 4L12 12" /><path d="M4 12L12 4" />      </svg>    </button>  </dialog></div>
import ChevronsUpDownIcon from '@master/icons-react/native/16/soft/chevrons-up-down'import PlusIcon from '@master/icons-react/native/16/soft/plus'import SearchIcon from '@master/icons-react/native/16/soft/search'import HomeIcon from '@master/icons-react/native/16/soft/home'import GridIcon from '@master/icons-react/native/16/soft/grid'import RocketIcon from '@master/icons-react/native/16/soft/rocket'import ChevronDownIcon from '@master/icons-react/native/16/soft/chevron-down'import GlobeIcon from '@master/icons-react/native/16/soft/globe'import ChartBarIcon from '@master/icons-react/native/16/soft/chart-bar'import UsersIcon from '@master/icons-react/native/16/soft/users'import CreditCardIcon from '@master/icons-react/native/16/soft/credit-card'import SlidersIcon from '@master/icons-react/native/16/soft/sliders'import MoreHorizontalIcon from '@master/icons-react/native/16/soft/more-horizontal'import LogOutIcon from '@master/icons-react/native/16/soft/log-out'import BarsIcon from '@master/icons-react/native/16/soft/bars'import XIcon from '@master/icons-react/native/16/soft/x'<div className="shell bg-surface-tray fg-text-body text-sm">  <a className="skip" href="#sb-main">Skip to content</a>  <aside className="shell-sidebar gap-sm p-sm">    <button type="button" className="btn btn-quiet justify-start px(6)" popoverTarget="sb-workspace">      <span className="avatar avatar-xs avatar-square" aria-hidden="true">A</span> Atlas Labs <span className="ml-auto fg-text-muted"><ChevronsUpDownIcon className="icon" /></span>    </button>    <div className="menu" id="sb-workspace" popover="">      <div className="menu-label">Workspaces</div>      <button type="button" className="menu-item" popoverTarget="sb-workspace" popoverTargetAction="hide">        Atlas Labs      </button>      <button type="button" className="menu-item" popoverTarget="sb-workspace" popoverTargetAction="hide">        Personal      </button>      <hr className="menu-separator" />      <button type="button" className="menu-item" popoverTarget="sb-workspace" popoverTargetAction="hide">        <PlusIcon className="icon" />New workspace      </button>    </div>    <label className="input-group input-group-sm">      <SearchIcon className="icon" />      <input className="input-group-field" type="search" placeholder="Search" aria-label="Search" />      <kbd className="kbd">⌘</kbd><kbd className="kbd">K</kbd>    </label>    <nav className="nav" aria-label="Workspace">      <a className="nav-item" href="#"><HomeIcon className="icon" />Overview</a>      <a className="nav-item" href="#" aria-current="page">        <GridIcon className="icon" />Projects<span className="nav-end">12</span>      </a>      <details className="nav-group" open>        <summary className="nav-item nav-toggle">          <RocketIcon className="icon" />Deployments<ChevronDownIcon className="icon nav-chevron" />        </summary>        <div className="nav-sub">          <a className="nav-item" href="#">Production</a>          <a className="nav-item" href="#">Preview<span className="nav-end">3</span></a>        </div>      </details>      <a className="nav-item" href="#"><GlobeIcon className="icon" />Domains</a>      <a className="nav-item" href="#"><ChartBarIcon className="icon" />Analytics</a>      <div className="nav-label">Team</div>      <a className="nav-item" href="#"><UsersIcon className="icon" />Members</a>      <a className="nav-item" href="#"><CreditCardIcon className="icon" />Billing</a>      <a className="nav-item" href="#"><SlidersIcon className="icon" />Settings</a>    </nav>    <div className="flex flex-col gap-sm mt-auto">      <section className="well flex flex-col gap-xs p-sm" aria-labelledby="sb-usage">        <div className="flex items-baseline justify-between gap-sm text-xs">          <span className="fg-text-strong" id="sb-usage">Build minutes</span>          <span className="fg-text-muted">296 of 400</span>        </div>        <meter className="meter meter-sm" min="0" max="400" low={240} high={360} optimum={0} value="296" aria-labelledby="sb-usage">          296 of 400 build minutes        </meter>        <a className="link text-xs self-start" href="#">Upgrade</a>      </section>      <button type="button" className="btn btn-quiet justify-start px(6)" popoverTarget="sb-account">        <span className="avatar avatar-xs">          <img className="avatar-image" src="/demo/people/yiching-lin.webp" alt="" width="256" height="256" />        </span> Yi-ching Lin <span className="ml-auto fg-text-muted"><MoreHorizontalIcon className="icon" /></span>      </button>      <div className="menu menu-top" id="sb-account" popover="">        <a className="menu-item" href="#">Account settings</a>        <a className="menu-item" href="#">Keyboard shortcuts</a>        <hr className="menu-separator" />        <button type="button" className="menu-item" popoverTarget="sb-account" popoverTargetAction="hide">          <LogOutIcon className="icon" />Sign out        </button>      </div>    </div>  </aside>  <div className="shell-main flex flex-col gap(8) p(8) pxs(0)@container(--3xl)">    <button type="button" className="btn btn-sm shell-toggle self-start" {...{ commandfor: 'sb-drawer', command: 'show-modal' }}>      <BarsIcon className="icon" />Menu    </button>    <main className="sheet grow(1) flex items-center justify-center p-xl" id="sb-main" tabIndex={-1}>      <p className="m(0) fg-text-muted text-center max-w(320)">        The sidebar is the block. The sheet beside it is where the page goes.      </p>    </main>  </div>  <dialog className="dialog dialog-drawer dialog-drawer-start" id="sb-drawer" closedby="any" aria-label="Navigation">    <div className="dialog-body flex flex-col gap-sm">      <p className="m(0) px-xs h(32) flex items-center fg-text-strong font-medium">Atlas Labs</p>      <nav className="nav" aria-label="Workspace, in the drawer">        <a className="nav-item" href="#"><HomeIcon className="icon" />Overview</a>        <a className="nav-item" href="#" aria-current="page">          <GridIcon className="icon" />Projects<span className="nav-end">12</span>        </a>        <details className="nav-group" open>          <summary className="nav-item nav-toggle">            <RocketIcon className="icon" />Deployments<ChevronDownIcon className="icon nav-chevron" />          </summary>          <div className="nav-sub">            <a className="nav-item" href="#">Production</a>            <a className="nav-item" href="#">Preview<span className="nav-end">3</span></a>          </div>        </details>        <a className="nav-item" href="#"><GlobeIcon className="icon" />Domains</a>        <a className="nav-item" href="#"><ChartBarIcon className="icon" />Analytics</a>        <div className="nav-label">Team</div>        <a className="nav-item" href="#"><UsersIcon className="icon" />Members</a>        <a className="nav-item" href="#"><CreditCardIcon className="icon" />Billing</a>        <a className="nav-item" href="#"><SlidersIcon className="icon" />Settings</a>      </nav>    </div>    <button type="button" className="btn btn-quiet btn-square btn-sm dialog-close" {...{ commandfor: 'sb-drawer', command: 'close' }} aria-label="Close navigation">      <XIcon className="icon" />    </button>  </dialog></div>
<script>  import ChevronsUpDownIcon from '@master/icons-svelte/native/16/soft/chevrons-up-down'  import PlusIcon from '@master/icons-svelte/native/16/soft/plus'  import SearchIcon from '@master/icons-svelte/native/16/soft/search'  import HomeIcon from '@master/icons-svelte/native/16/soft/home'  import GridIcon from '@master/icons-svelte/native/16/soft/grid'  import RocketIcon from '@master/icons-svelte/native/16/soft/rocket'  import ChevronDownIcon from '@master/icons-svelte/native/16/soft/chevron-down'  import GlobeIcon from '@master/icons-svelte/native/16/soft/globe'  import ChartBarIcon from '@master/icons-svelte/native/16/soft/chart-bar'  import UsersIcon from '@master/icons-svelte/native/16/soft/users'  import CreditCardIcon from '@master/icons-svelte/native/16/soft/credit-card'  import SlidersIcon from '@master/icons-svelte/native/16/soft/sliders'  import MoreHorizontalIcon from '@master/icons-svelte/native/16/soft/more-horizontal'  import LogOutIcon from '@master/icons-svelte/native/16/soft/log-out'  import BarsIcon from '@master/icons-svelte/native/16/soft/bars'  import XIcon from '@master/icons-svelte/native/16/soft/x'</script><div class="shell bg-surface-tray fg-text-body text-sm">  <a class="skip" href="#sb-main">Skip to content</a>  <aside class="shell-sidebar gap-sm p-sm">    <button type="button" class="btn btn-quiet justify-start px(6)" popovertarget="sb-workspace">      <span class="avatar avatar-xs avatar-square" aria-hidden="true">A</span> Atlas Labs <span class="ml-auto fg-text-muted"><ChevronsUpDownIcon class="icon" /></span>    </button>    <div class="menu" id="sb-workspace" popover>      <div class="menu-label">Workspaces</div>      <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">        Atlas Labs      </button>      <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">        Personal      </button>      <hr class="menu-separator">      <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">        <PlusIcon class="icon" />New workspace      </button>    </div>    <label class="input-group input-group-sm">      <SearchIcon class="icon" />      <input class="input-group-field" type="search" placeholder="Search" aria-label="Search">      <kbd class="kbd">⌘</kbd><kbd class="kbd">K</kbd>    </label>    <nav class="nav" aria-label="Workspace">      <a class="nav-item" href="#"><HomeIcon class="icon" />Overview</a>      <a class="nav-item" href="#" aria-current="page">        <GridIcon class="icon" />Projects<span class="nav-end">12</span>      </a>      <details class="nav-group" open>        <summary class="nav-item nav-toggle">          <RocketIcon class="icon" />Deployments<ChevronDownIcon class="icon nav-chevron" />        </summary>        <div class="nav-sub">          <a class="nav-item" href="#">Production</a>          <a class="nav-item" href="#">Preview<span class="nav-end">3</span></a>        </div>      </details>      <a class="nav-item" href="#"><GlobeIcon class="icon" />Domains</a>      <a class="nav-item" href="#"><ChartBarIcon class="icon" />Analytics</a>      <div class="nav-label">Team</div>      <a class="nav-item" href="#"><UsersIcon class="icon" />Members</a>      <a class="nav-item" href="#"><CreditCardIcon class="icon" />Billing</a>      <a class="nav-item" href="#"><SlidersIcon class="icon" />Settings</a>    </nav>    <div class="flex flex-col gap-sm mt-auto">      <section class="well flex flex-col gap-xs p-sm" aria-labelledby="sb-usage">        <div class="flex items-baseline justify-between gap-sm text-xs">          <span class="fg-text-strong" id="sb-usage">Build minutes</span>          <span class="fg-text-muted">296 of 400</span>        </div>        <meter class="meter meter-sm" min="0" max="400" low="240" high="360" optimum="0" value="296" aria-labelledby="sb-usage">          296 of 400 build minutes        </meter>        <a class="link text-xs self-start" href="#">Upgrade</a>      </section>      <button type="button" class="btn btn-quiet justify-start px(6)" popovertarget="sb-account">        <span class="avatar avatar-xs">          <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256">        </span> Yi-ching Lin <span class="ml-auto fg-text-muted"><MoreHorizontalIcon class="icon" /></span>      </button>      <div class="menu menu-top" id="sb-account" popover>        <a class="menu-item" href="#">Account settings</a>        <a class="menu-item" href="#">Keyboard shortcuts</a>        <hr class="menu-separator">        <button type="button" class="menu-item" popovertarget="sb-account" popovertargetaction="hide">          <LogOutIcon class="icon" />Sign out        </button>      </div>    </div>  </aside>  <div class="shell-main flex flex-col gap(8) p(8) pxs(0)@container(--3xl)">    <button type="button" class="btn btn-sm shell-toggle self-start" commandfor="sb-drawer" command="show-modal">      <BarsIcon class="icon" />Menu    </button>    <main class="sheet grow(1) flex items-center justify-center p-xl" id="sb-main" tabindex="-1">      <p class="m(0) fg-text-muted text-center max-w(320)">        The sidebar is the block. The sheet beside it is where the page goes.      </p>    </main>  </div>  <dialog class="dialog dialog-drawer dialog-drawer-start" id="sb-drawer" closedby="any" aria-label="Navigation">    <div class="dialog-body flex flex-col gap-sm">      <p class="m(0) px-xs h(32) flex items-center fg-text-strong font-medium">Atlas Labs</p>      <nav class="nav" aria-label="Workspace, in the drawer">        <a class="nav-item" href="#"><HomeIcon class="icon" />Overview</a>        <a class="nav-item" href="#" aria-current="page">          <GridIcon class="icon" />Projects<span class="nav-end">12</span>        </a>        <details class="nav-group" open>          <summary class="nav-item nav-toggle">            <RocketIcon class="icon" />Deployments<ChevronDownIcon class="icon nav-chevron" />          </summary>          <div class="nav-sub">            <a class="nav-item" href="#">Production</a>            <a class="nav-item" href="#">Preview<span class="nav-end">3</span></a>          </div>        </details>        <a class="nav-item" href="#"><GlobeIcon class="icon" />Domains</a>        <a class="nav-item" href="#"><ChartBarIcon class="icon" />Analytics</a>        <div class="nav-label">Team</div>        <a class="nav-item" href="#"><UsersIcon class="icon" />Members</a>        <a class="nav-item" href="#"><CreditCardIcon class="icon" />Billing</a>        <a class="nav-item" href="#"><SlidersIcon class="icon" />Settings</a>      </nav>    </div>    <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="sb-drawer" command="close" aria-label="Close navigation">      <XIcon class="icon" />    </button>  </dialog></div>
<script setup>import ChevronsUpDownIcon from '@master/icons-vue/native/16/soft/chevrons-up-down'import PlusIcon from '@master/icons-vue/native/16/soft/plus'import SearchIcon from '@master/icons-vue/native/16/soft/search'import HomeIcon from '@master/icons-vue/native/16/soft/home'import GridIcon from '@master/icons-vue/native/16/soft/grid'import RocketIcon from '@master/icons-vue/native/16/soft/rocket'import ChevronDownIcon from '@master/icons-vue/native/16/soft/chevron-down'import GlobeIcon from '@master/icons-vue/native/16/soft/globe'import ChartBarIcon from '@master/icons-vue/native/16/soft/chart-bar'import UsersIcon from '@master/icons-vue/native/16/soft/users'import CreditCardIcon from '@master/icons-vue/native/16/soft/credit-card'import SlidersIcon from '@master/icons-vue/native/16/soft/sliders'import MoreHorizontalIcon from '@master/icons-vue/native/16/soft/more-horizontal'import LogOutIcon from '@master/icons-vue/native/16/soft/log-out'import BarsIcon from '@master/icons-vue/native/16/soft/bars'import XIcon from '@master/icons-vue/native/16/soft/x'</script><template>  <div class="shell bg-surface-tray fg-text-body text-sm">    <a class="skip" href="#sb-main">Skip to content</a>    <aside class="shell-sidebar gap-sm p-sm">      <button type="button" class="btn btn-quiet justify-start px(6)" popovertarget="sb-workspace">        <span class="avatar avatar-xs avatar-square" aria-hidden="true">A</span> Atlas Labs <span class="ml-auto fg-text-muted"><ChevronsUpDownIcon class="icon" /></span>      </button>      <div class="menu" id="sb-workspace" popover>        <div class="menu-label">Workspaces</div>        <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">          Atlas Labs        </button>        <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">          Personal        </button>        <hr class="menu-separator">        <button type="button" class="menu-item" popovertarget="sb-workspace" popovertargetaction="hide">          <PlusIcon class="icon" />New workspace        </button>      </div>      <label class="input-group input-group-sm">        <SearchIcon class="icon" />        <input class="input-group-field" type="search" placeholder="Search" aria-label="Search">        <kbd class="kbd">⌘</kbd><kbd class="kbd">K</kbd>      </label>      <nav class="nav" aria-label="Workspace">        <a class="nav-item" href="#"><HomeIcon class="icon" />Overview</a>        <a class="nav-item" href="#" aria-current="page">          <GridIcon class="icon" />Projects<span class="nav-end">12</span>        </a>        <details class="nav-group" open>          <summary class="nav-item nav-toggle">            <RocketIcon class="icon" />Deployments<ChevronDownIcon class="icon nav-chevron" />          </summary>          <div class="nav-sub">            <a class="nav-item" href="#">Production</a>            <a class="nav-item" href="#">Preview<span class="nav-end">3</span></a>          </div>        </details>        <a class="nav-item" href="#"><GlobeIcon class="icon" />Domains</a>        <a class="nav-item" href="#"><ChartBarIcon class="icon" />Analytics</a>        <div class="nav-label">Team</div>        <a class="nav-item" href="#"><UsersIcon class="icon" />Members</a>        <a class="nav-item" href="#"><CreditCardIcon class="icon" />Billing</a>        <a class="nav-item" href="#"><SlidersIcon class="icon" />Settings</a>      </nav>      <div class="flex flex-col gap-sm mt-auto">        <section class="well flex flex-col gap-xs p-sm" aria-labelledby="sb-usage">          <div class="flex items-baseline justify-between gap-sm text-xs">            <span class="fg-text-strong" id="sb-usage">Build minutes</span>            <span class="fg-text-muted">296 of 400</span>          </div>          <meter class="meter meter-sm" min="0" max="400" low="240" high="360" optimum="0" value="296" aria-labelledby="sb-usage">            296 of 400 build minutes          </meter>          <a class="link text-xs self-start" href="#">Upgrade</a>        </section>        <button type="button" class="btn btn-quiet justify-start px(6)" popovertarget="sb-account">          <span class="avatar avatar-xs">            <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256">          </span> Yi-ching Lin <span class="ml-auto fg-text-muted"><MoreHorizontalIcon class="icon" /></span>        </button>        <div class="menu menu-top" id="sb-account" popover>          <a class="menu-item" href="#">Account settings</a>          <a class="menu-item" href="#">Keyboard shortcuts</a>          <hr class="menu-separator">          <button type="button" class="menu-item" popovertarget="sb-account" popovertargetaction="hide">            <LogOutIcon class="icon" />Sign out          </button>        </div>      </div>    </aside>    <div class="shell-main flex flex-col gap(8) p(8) pxs(0)@container(--3xl)">      <button type="button" class="btn btn-sm shell-toggle self-start" commandfor="sb-drawer" command="show-modal">        <BarsIcon class="icon" />Menu      </button>      <main class="sheet grow(1) flex items-center justify-center p-xl" id="sb-main" tabindex="-1">        <p class="m(0) fg-text-muted text-center max-w(320)">          The sidebar is the block. The sheet beside it is where the page goes.        </p>      </main>    </div>    <dialog class="dialog dialog-drawer dialog-drawer-start" id="sb-drawer" closedby="any" aria-label="Navigation">      <div class="dialog-body flex flex-col gap-sm">        <p class="m(0) px-xs h(32) flex items-center fg-text-strong font-medium">Atlas Labs</p>        <nav class="nav" aria-label="Workspace, in the drawer">          <a class="nav-item" href="#"><HomeIcon class="icon" />Overview</a>          <a class="nav-item" href="#" aria-current="page">            <GridIcon class="icon" />Projects<span class="nav-end">12</span>          </a>          <details class="nav-group" open>            <summary class="nav-item nav-toggle">              <RocketIcon class="icon" />Deployments<ChevronDownIcon class="icon nav-chevron" />            </summary>            <div class="nav-sub">              <a class="nav-item" href="#">Production</a>              <a class="nav-item" href="#">Preview<span class="nav-end">3</span></a>            </div>          </details>          <a class="nav-item" href="#"><GlobeIcon class="icon" />Domains</a>          <a class="nav-item" href="#"><ChartBarIcon class="icon" />Analytics</a>          <div class="nav-label">Team</div>          <a class="nav-item" href="#"><UsersIcon class="icon" />Members</a>          <a class="nav-item" href="#"><CreditCardIcon class="icon" />Billing</a>          <a class="nav-item" href="#"><SlidersIcon class="icon" />Settings</a>        </nav>      </div>      <button type="button" class="btn btn-quiet btn-square btn-sm dialog-close" commandfor="sb-drawer" command="close" aria-label="Close navigation">        <XIcon class="icon" />      </button>    </dialog>  </div></template>
上部のワークスペースと下部のアカウントを開いてみてください。それぞれのボタンを基準にメニューが開きます。「スマートフォン」を選ぶとサイドバーが非表示になり、「Menu」ボタンで同じナビゲーションがドロワーに開きます。

ブロックの範囲は <aside class="shell-sidebar"> の内側全体です。サイドバーの位置、高さ、非表示になる条件はシェルが決め、サイドバーの中身はこのブロックが定義します。

#構成

  • ワークスペースは、メニューを開く控えめなボタンです。 justify-start で内容を始端に揃え、ml-auto でマークを終端に寄せます。名前の横の文字はアバターです。名前で識別できるため、アバターは支援技術から隠します。
  • 検索には小さな入力グループを使います。 ショートカットはキーごとにキーキャップを1つ、計2つ使って表示し、コマンドパレットを開くように設定します。
  • ナビゲーションには nav を使います。 アイコン、件数、グループ、ラベルを配置します。グループにはネイティブの <details> を使うため、スクリプトなしで開けます。
  • 使用量はメーター付きのウェルに表示します。 ここではプランのビルド時間を分単位で示し、プランを変更するリンクを添えます。
  • アカウントは控えめなボタンで、押すとそのすぐ上にメニューが開きます。 メニューの配置には menu-top を使います。列の最後に置き、mt-auto で下端に寄せます。
  • 1列に並べ、間隔を揃えます。 サイドバーは縦方向の flex レイアウトです。gap-sm で要素間の間隔を取り、p-sm で端に余白を設けます。最後のグループは mt-auto で下端に寄せます。
  • サイドバーは独立してスクロールします。 ナビゲーションがビューポートの高さを超えると、shell-sidebar によってサイドバー内でスクロールできます。
  • サイドバー自体に背景面はありません。 シェルのトレイを背景に使います。現在のページに対応する行は、ナビゲーション側のスタイルで小さなシートのように浮き上がって見えます。

#ドロワー内のナビゲーション

シェルの幅が 48rem 未満になると、サイドバーはレイアウトから外れます。スマートフォンでも移動先を選べるよう、上の例ではサイドバーが非表示の間だけ shell-toggle を持つボタンを表示します。このボタンは dialog-drawer-start を持つドロワーを開き、同じナビゲーションを別のラベルで表示します。外枠の構成はアプリシェルを参照してください。スマートフォンには独自の検索機能があるため、ドロワーには検索欄を入れません。

#アクセシビリティ

  • サイドバーには <aside> を使い、リンクはラベル付きの <nav> にまとめます。現在のページには aria-current="page" を指定します。
  • ワークスペースとアカウントのボタンは、ボタンやリンクを含むメニューを開きます。どちらもシンプルなポップオーバーで、Tab キーで項目間を移動し、Escape キーで閉じられます。
  • 名前の横のアバターは装飾なので、alt は空にします。
  • メーターの値はテキストでも示し、隣のラベルをメーターの名前として使います。
  • ドロワーには <dialog> を使います。開くとフォーカスが中に移動します。閉じるボタン、ドロワーの外側のクリック、Esc キーのいずれかで閉じると、フォーカスは「Menu」ボタンに戻ります。