Skip to content

CSS: drawer-layout.tray

.tray — 位於主要內容旁的側邊面板,支援可選的覆蓋層與托盤式表面修飾。

定位使用 inset-inline-start/inset-inline(絕不使用 left/right),因此 -placement-end 在 LTR 與 RTL 中都會錨靠於真正的尾端邊緣。

無障礙

若用作導覽,請將連結包在語義性的 <nav> 中,並提供可及的名稱。

使用方法

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/drawer-layout.tray.css";

範例

html
<div class="instui-drawer-layout" open>
  <aside class="tray" aria-label="Course navigation">
    <a class="instui-link" href="#">Modules</a>
  </aside>
  <main class="content" role="region">Main content</main>
</div>

結構

text
@scope (@component drawer-layout)
  .tray
    ‹content›
flowchart TD subgraph sg0 ["@scope (@component drawer-layout)"] n1(".tray"):::cssdoc-part n2[/"‹content›"/]:::cssdoc-slot end n1 --> n2 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

修飾器

修飾器說明
.-placement-end當覆蓋模式啟用時,將此托盤停靠於 inline-end。
.-without-border移除面板邊緣邊框。
.-without-shadow當覆蓋模式啟用時,移除提升效果(elevation)。

條件

型別查詢說明
containerpantoken-drawer-layout (max-width: 46em)

已使用的代幣

Token型別
--drawer-layout-tray-width
--instui-border-width-sm<length>0.0625rem
--instui-color-background-elevated-surface-base<color>LightDarklight-dark(#ffffff, #171B21)
--instui-color-stroke-base<color>LightDarklight-dark(#8D959F, #6A7883)
--instui-component-tray-width-xs<length>16em
--instui-component-tray-z-index<integer>9999
--instui-elevation-topmostnone | <shadow>#

相關