媒體
視窗
為螢幕擷取畫面、示範或終端機加上應用程式視窗外框。
本頁內容
視窗以應用程式外框呈現你想展示的內容,例如螢幕擷取畫面、簡短示範或幾行終端機輸出。視窗面板略微浮起,頂列橫跨整個視窗。頂列上的三個標記採用與框線相同的無彩色,讓人一眼認出這是視窗,也讓內容本身的色彩成為焦點。
視窗
<figure class="window max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-title">Atlas · Deployments</span> </div> <img class="window-body object-cover w-full" style="aspect-ratio: 16 / 10" src="/demo/moonstone.svg" alt="The deployments view of Atlas"></figure><figure className="window max-w(520) mx-auto"> <div className="window-bar"> <span className="window-controls" aria-hidden="true"></span> <span className="window-title">Atlas · Deployments</span> </div> <img className="window-body object-cover w-full" style={{ aspectRatio: '16 / 10' }} src="/demo/moonstone.svg" alt="The deployments view of Atlas" /></figure><figure class="window max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-title">Atlas · Deployments</span> </div> <img class="window-body object-cover w-full" style="aspect-ratio: 16 / 10" src="/demo/moonstone.svg" alt="The deployments view of Atlas"></figure><template> <figure class="window max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-title">Atlas · Deployments</span> </div> <img class="window-body object-cover w-full" style="aspect-ratio: 16 / 10" src="/demo/moonstone.svg" alt="The deployments view of Atlas"> </figure></template>#頂列
window-bar 分為三個區域。起始端放置 window-controls,它是一個呈現為三個實心圓的空元素。中央可放 window-title 或 window-address,後者是帶有內凹效果的網址欄,類似瀏覽器的網址列。window-end 用來容納尾端的內容。各區域都可省略,中央區域會維持置中,不受兩側內容影響。
網址
<figure class="window max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-address"> <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="3" y="7" width="10" height="7" rx="1" /><path d="M5.5 7V4.5A2.5 2.5 0 0 1 10.5 4.5V7" /><path d="M8 9.5L8 11" /> </svg>atlas.dev/deployments </span> <span class="window-end"><span class="badge badge-sm badge-success badge-dot">Live</span></span> </div> <div class="window-body flex flex-col gap-sm p-lg"> <div class="skeleton skeleton-text w(180)"></div> <div class="skeleton skeleton-text"></div> <div class="skeleton skeleton-text w(320)"></div> <div class="skeleton h(96) mt-xs"></div> </div></figure>import LockIcon from '@master/icons-react/native/16/soft/lock'<figure className="window max-w(520) mx-auto"> <div className="window-bar"> <span className="window-controls" aria-hidden="true"></span> <span className="window-address"><LockIcon className="icon" />atlas.dev/deployments</span> <span className="window-end"> <span className="badge badge-sm badge-success badge-dot">Live</span> </span> </div> <div className="window-body flex flex-col gap-sm p-lg"> <div className="skeleton skeleton-text w(180)"></div> <div className="skeleton skeleton-text"></div> <div className="skeleton skeleton-text w(320)"></div> <div className="skeleton h(96) mt-xs"></div> </div></figure><script> import LockIcon from '@master/icons-svelte/native/16/soft/lock'</script><figure class="window max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-address"><LockIcon class="icon" />atlas.dev/deployments</span> <span class="window-end"><span class="badge badge-sm badge-success badge-dot">Live</span></span> </div> <div class="window-body flex flex-col gap-sm p-lg"> <div class="skeleton skeleton-text w(180)"></div> <div class="skeleton skeleton-text"></div> <div class="skeleton skeleton-text w(320)"></div> <div class="skeleton h(96) mt-xs"></div> </div></figure><script setup>import LockIcon from '@master/icons-vue/native/16/soft/lock'</script><template> <figure class="window max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-address"><LockIcon class="icon" />atlas.dev/deployments</span> <span class="window-end"> <span class="badge badge-sm badge-success badge-dot">Live</span> </span> </div> <div class="window-body flex flex-col gap-sm p-lg"> <div class="skeleton skeleton-text w(180)"></div> <div class="skeleton skeleton-text"></div> <div class="skeleton skeleton-text w(320)"></div> <div class="skeleton h(96) mt-xs"></div> </div> </figure></template>#內容區
window-body 沒有內距,讓圖片或影片貼齊外框,並由視窗的圓角裁切。若要留出文字周圍的空間,請使用設定內距的工具類別。請將這個類別加在內容元素本身,例如 <img>、<video>、<pre> 或 <div>。
window-flat 保留一道外框並移除陰影,適合放在容器內,或與其他內容一起放在版面密集的頁面上。
終端機
<figure class="window window-flat max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-title">zsh</span> </div> <pre class="window-body p-md font-mono text-xs leading-lg fg-text-strong overflow-x-auto"><span class="fg-text-muted">$</span> npm install @master/css @master/ui<span class="fg-text-muted">added 2 packages in 1.4s</span><span class="fg-text-muted">$</span> npm run dev</pre></figure><figure class="window window-flat max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-title">zsh</span> </div> <pre class="window-body p-md font-mono text-xs leading-lg fg-text-strong overflow-x-auto"><span class="fg-text-muted">$</span> npm install @master/css @master/ui<span class="fg-text-muted">added 2 packages in 1.4s</span><span class="fg-text-muted">$</span> npm run dev</pre></figure><template> <figure class="window window-flat max-w(520) mx-auto"> <div class="window-bar"> <span class="window-controls" aria-hidden="true"></span> <span class="window-title">zsh</span> </div> <pre class="window-body p-md font-mono text-xs leading-lg fg-text-strong overflow-x-auto"><span class="fg-text-muted">$</span> npm install @master/css @master/ui<span class="fg-text-muted">added 2 packages in 1.4s</span><span class="fg-text-muted">$</span> npm run dev</pre> </figure></template>#無障礙
- 外框僅供裝飾。請用
aria-hidden="true"隱藏window-controls,這些圓點只是裝飾,不具按鈕功能。 - 如果視窗用來輔助說明周圍的文字,可以使用
<figure>。若畫面需要解說,請在該元素內的視窗內容後加上<figcaption>。 - 請在
alt中描述螢幕擷取畫面。頂列標題是畫面的一部分,無法取代替代文字。 - 請勿用視窗元件製作可操作的對話框。若需要在頁面上方開啟對話框,請使用 dialog。
#類別
| 類別 | 說明 |
|---|---|
window | 外框略帶立體感,圓角為 12px,並裁切超出的內容 |
window-flat | 使用單一道外框,適合托盤上或版面緊湊頁面中的視窗。無陰影。搭配 window 使用 |
window-bar | 頂端橫列,起始端放標記,中間放標題或網址,末端預留控制項的位置 |
window-controls | 頂端橫列起始端的三個標記由同一個空元素繪製。請使用 aria-hidden="true",讓輔助技術略過該元素 |
window-title | 單行標題置於頂端橫列中央 |
window-address | 頂端橫列中央改以小型網址框顯示網址 |
window-end | 位於頂端橫列末端的內容 |
window-body | 視窗顯示的內容,可以是圖片、影片、pre 或 div,內距為 0 |
#自訂屬性
| 屬性 | 預設值 | 說明 |
|---|---|---|
--window-radius | var(--radius-control-lg) | 外框圓角 |
--window-bar-height | 2.5rem | 頂端橫列高度 |
#相關元件
- 裝置以手機外框呈現螢幕截圖、影片或可操作的示範。
- 圖文呈現搭配圖說的圖片或影片,並修飾媒體邊緣。
- 卡片帶有浮起效果的面板,各部分會依卡片可用空間調整。
- 程式碼以等寬字型呈現原樣文字,可放在行內或獨立成區塊。