导航

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>
打开顶部的工作区菜单或底部的账户菜单,两个菜单都以各自的按钮为锚点。选择 Phone 预览时,侧边栏会退出布局,点击 Menu 可在抽屉中打开同一套导航。

<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 均可关闭抽屉,随后焦点返回 Menu 按钮。