탐색

v2.1.0
미디어

창

스크린샷, 데모 또는 터미널을 감싸는 애플리케이션 창 형태의 프레임입니다.

이 페이지의 내용

창은 스크린샷, 짧은 데모, 몇 줄의 터미널 출력처럼 보여 주려는 콘텐츠를 애플리케이션 창처럼 감싸는 프레임입니다. 살짝 떠 있는 판의 상단에 가로 막대가 놓입니다. 막대의 표시 세 개는 윤곽선과 같은 무채색으로 그려 창의 형태를 알아볼 수 있게 하고, 콘텐츠 자체의 색이 돋보이게 합니다.

창

<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에 설명하세요. 막대의 제목은 그림의 일부이며 스크린샷의 대체 설명을 대신할 수 없습니다.
  • 실제로 동작하는 대화 상자를 만드는 데는 이 컴포넌트를 사용하지 않습니다. 페이지 위에 열리는 창에는 대화 상자를 사용합니다.

#클래스

클래스설명
window프레임은 살짝 떠 보이는 표면입니다. 모서리 반경은 12px이며, 프레임 밖으로 넘치는 콘텐츠는 잘라냅니다.
window-flat트레이 위나 콘텐츠가 촘촘한 페이지에 놓인 창에 윤곽선 하나만 적용하고 그림자는 생략합니다.적용할 클래스는 window입니다
window-bar상단을 가로지르는 바입니다. 시작 쪽에는 표식을, 가운데에는 제목이나 주소를 배치하고, 끝에는 컨트롤을 넣을 공간을 둡니다.
window-controls빈 요소 하나로 상단 바의 시작 쪽에 표식 3개를 그립니다. 해당 요소는 aria-hidden="true"로 보조 기술에서 숨깁니다.
window-title바 중앙에 놓인 한 줄 제목
window-address제목 대신 바 중앙의 작은 오목한 영역에 표시하는 주소
window-end상단 바 끝에 표시되는 요소
window-body창에는 이미지, 동영상, pre 또는 div를 표시할 수 있습니다. 안쪽 여백은 없습니다.

#사용자 지정 속성

속성기본값설명
--window-radiusvar(--radius-control-lg)프레임의 모서리 반경
--window-bar-height2.5rem상단 바의 높이

#소스

@master/ui/components/window.css
/* * Window: the frame of an application around a screenshot, a demo or a few lines of a terminal. * A lifted sheet with a 12px corner. Its bar is a quieter tone over a hairline and carries three marks at * the start, drawn from one element in the ink of a line, with no hue: the frame says "this is a window" * and leaves the color to what it shows. A title stands in the middle of the bar, or an address in a small * well. The body is cut by the window's own corner, so a picture runs to the edge. */@layer components.ui {  .window {    --window-radius: var(--radius-control-lg);    --window-bar-height: 2.5rem;    --surface-color: var(--color-surface-raised);    position: relative;    display: flex;    flex-direction: column;    min-width: 0;    margin: 0;    border-radius: calc(var(--window-radius) * var(--corner-scale));    corner-shape: var(--corner-shape);    /* The bar's tone and a picture in the body are finished by the window's corner. */    overflow: clip;    background: var(--color-surface-raised);    color: var(--color-text-body);    box-shadow: var(--shadow-lifted);    /* One contour and no lift, for a window on a tray or in a dense page. */    &.window-flat {      box-shadow: var(--shadow-flat);    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }  /* The bar: the marks at the start, the title or the address in the middle, and room for a control at the end. */  .window-bar {    display: grid;    flex: none;    /* The sides never shrink below what they hold, so a long title is cut instead of running under the marks. */    grid-template-columns: minmax(min-content, 1fr) auto minmax(min-content, 1fr);    align-items: center;    gap: .75rem;    min-height: var(--window-bar-height);    padding: 0 .875rem;    border-block-end: 1px solid var(--color-line-hair);    @apply --surface-sheet;    box-shadow: inset 0 1px 0 var(--color-highlight);  }  /* Three marks, 11px each, 8px apart: discs of the line ink with a faint edge of their own. */  .window-controls {    --window-mark: var(--color-line-strong);    display: block;    width: 3.0625rem;    height: .6875rem;    background:      radial-gradient(circle at 5.5px 50%, var(--window-mark) 5px, transparent 5.5px),      radial-gradient(circle at 24.5px 50%, var(--window-mark) 5px, transparent 5.5px),      radial-gradient(circle at 43.5px 50%, var(--window-mark) 5px, transparent 5.5px);    @media (forced-colors: active) {      --window-mark: CanvasText;      forced-color-adjust: none;    }  }  .window-title {    grid-column: 2;    max-width: 100%;    margin: 0;    overflow: hidden;    color: var(--color-text-muted);    font: var(--font-weight-control) .8125rem/1.2 var(--font-family-sans);    font-feature-settings: inherit;    text-align: center;    text-overflow: ellipsis;    white-space: nowrap;  }  /* An address instead of a title: a small well in the middle of the bar, as a browser has. */  .window-address {    --icon-size: .75rem;    display: inline-flex;    grid-column: 2;    align-items: center;    /* An address longer than the well keeps its start in view and is cut at its end. */    justify-content: safe center;    gap: .375rem;    width: min(100%, 16rem);    min-width: 0;    height: 1.625rem;    padding: 0 .75rem;    border-radius: calc((var(--window-radius) - .25rem) * var(--corner-scale));    corner-shape: var(--corner-shape);    overflow: hidden;    background: var(--color-surface-inset);    color: var(--color-text-muted);    box-shadow: var(--shadow-pressed);    font: 400 .75rem/1 var(--font-family-sans);    font-feature-settings: inherit;    text-overflow: ellipsis;    white-space: nowrap;    /* Shadows are not drawn here, so the well keeps its edge as a rule. */    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }  /* What stands at the end of the bar. */  .window-end {    display: inline-flex;    grid-column: 3;    align-items: center;    justify-content: flex-end;    gap: .25rem;    min-width: 0;    color: var(--color-text-muted);  }  /* What the window shows. It has no padding: a picture or a video meets the frame. */  .window-body {    display: block;    flex: 1 1 auto;    min-width: 0;    min-height: 0;    margin: 0;  }}