Window
The frame of an application around a screenshot, a demo or a terminal.
On this page
A window is the frame of an application drawn around something you want to show: a screenshot, a short demo, a few lines of a terminal. It is a lifted sheet with a bar across its top. The three marks in the bar are drawn in the ink of a line, with no hue, so the frame says "this is a window" and leaves the color to what it holds.
Window
<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>#The bar
window-bar has three places. window-controls stands at the start: one empty element, drawn as three discs. In the middle goes a window-title, or a window-address, a small well like a browser's. window-end holds anything that belongs at the far end. Each part is optional, and the middle stays centered whatever stands beside it.
An address
<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 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M8 11V8a4 4 0 0 1 8 0v3M6 11h12v9H6z" /> </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>#The body
window-body has no padding, so a picture or a video meets the frame, and the window's own corner cuts it; give text its room with a padding utility. Put the class on the element that is the content: an <img>, a <video>, a <pre> or a <div>.
window-flat keeps one contour and drops the shadow, for a window on a tray or among other things on a dense page.
A terminal
<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>#Accessibility
- The frame is decoration. Hide
window-controlswitharia-hidden="true": the discs are not buttons and do nothing. - A
<figure>suits a window that illustrates the text around it; add a<figcaption>after it when the picture needs explaining. - Describe a screenshot in its
alt. The title in the bar is part of the picture, not a replacement for that description. - Do not build a working dialog from this. A window that opens over the page is a dialog.
#Classes
| Class | Description |
|---|---|
window | The frame: a lifted sheet with a 12px corner that clips what it holds |
window-flat | One contour and no shadow, for a window on a tray or in a dense page. With window |
window-bar | The bar across the top: marks at the start, a title or an address in the middle, room for a control at the end |
window-controls | Three marks at the start of the bar, drawn from one empty element; hide it with aria-hidden="true" |
window-title | A title in the middle of the bar, on one line |
window-address | An address in a small well in the middle of the bar, instead of a title |
window-end | What stands at the end of the bar |
window-body | What the window shows: an image, a video, a pre or a div. It has no padding |
#Custom properties
| Property | Default | Description |
|---|---|---|
--window-radius | var(--radius-control-lg) | Corner of the frame |
--window-bar-height | 2.5rem | Height of the bar |
#Related
- DeviceThe body of a phone around a screenshot, a video or a running demo.
- FigureAn image or a video with its caption, finished at the edge.
- CardA raised sheet whose parts follow the room the card is given.
- CodeLiteral text in the mono face, inline or as a block.