網站導覽

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>
開啟頂端的工作區或底部的帳號,兩者的選單都會以各自的按鈕為錨點。選擇「手機」檢視後,側邊欄會收起,按「選單」即可在抽屜中開啟同一組導覽。

區塊包含 <aside class="shell-sidebar"> 內的所有內容。側邊欄的位置、高度和收起時機由應用程式框架決定,區塊則負責其中的內容。

#組成

  • 工作區使用低調的按鈕開啟選單。 justify-start 將內容靠起始側對齊,ml-auto 將標記推到結尾側。名稱旁的字母是頭像,因為名稱已提供相同資訊,所以要對輔助技術隱藏。
  • 搜尋使用小型輸入群組。 快捷鍵用兩個鍵帽呈現,每個鍵帽對應一個按鍵。將快捷鍵連到指令面板。
  • 導覽使用導覽元件,包含圖示、數量、群組和標籤。群組使用原生 <details>,無須腳本即可展開。
  • 用量區是內含量表的凹槽。 顯示一項值得留意的數字,也就是方案的建置分鐘數,並提供可變更方案的連結。
  • 帳號使用低調按鈕,在按鈕上方開啟選單,由 menu-top 設定方向。它是直欄的最後一項,用 mt-auto 推到底部。
  • 單欄採用一致的間距。 側邊欄用 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 都能關閉抽屜,之後焦點會回到「選單」按鈕。